Vous êtes sur la page 1sur 6

SUBJECT:

Digital Signal Processing


TITLE:
Review of MATLAB Basics
1
EXPERIMENT NO. 01
DATE :
DOC. CODE: DIET/MEEC
REV. NO.: 1.00/!NE"#01#
Introduction to MATLAB
MATLAB is a high-performance language for technical computing. It integrates computation,
visualization, and programming in an easy-to-use environment. It can be used for Math and computation,
Algorithm development, Modeling, simulation, and prototyping, ata analysis, e!ploration, and visualization,
"cientific and engineering graphics ,Application development, including graphical user interface building etc.
MATLAB is an interactive system #hose basic data element is an array. The name MATLAB stands for matri!
laboratory. MATLAB #as originally #ritten to provide easy access to matri! soft#are developed by the
LI$%A&' and (I"%A&' pro)ects. The MATLAB family of programs includes the base program plus a variety
of application-specific solutions called toolbo!es . Toolbo!es are comprehensive collections of MATLAB
functions that e!tend the MATLAB environment to solve particular classes of problems.
Basic Examples working on Command Window
*ariable having single value
>> a = 1
a =
1
*ariable as a one dimensional array +vector,
$$ % & '1 # ()
%&
1 # (
*ariable as a t#o dimensional array +matri!,
$$ c & '1 # (*+ , -*. / 0)
c &
1 # (
+ , -
. / 0
efine vector #ith unit interval using colon +-,
operator
$$ 1 & "#: 1
1 &
"# "1 0 1
*ector #ith desired interval using colon operator
$$ 2 & + : "0., : #
2 &
+.0000 (.,000 (.0000 #.,000 #.0000
.or the above variables, e!tracting element or
group of elements
$$%3#4
ans & #
$$ c3#5(4
ans &
-
$$ c3#:(51:#4
ans &
+ ,
. /
$$23#:+4
ans &
(.,000 (.0000 #.,000
$$ c3#5:4
ans &
+ , -
*arious Arithmetic operators
/perator escription
0 Addition
- "ubtraction
1 Multiplication
.1 (lement#ise
multiplication
.2 (lement#ise division
.3 (lement#ise raising to a
scalar po#er
4 5 &oncatenation of matrices
6 &omple! con)ugate
Dars6an Instit7te o8 Engineering an9 Tec6nolog2 5 Ra:;ot
SUBJECT:
Digital Signal Processing
TITLE:
Review of MATLAB Basics
#
EXPERIMENT NO. 01
DATE :
DOC. CODE: DIET/MEEC
REV. NO.: 1.00/!NE"#01#
transpose
.6 Transpose
$$ a& ' 1 # ( + ,)
a&
1 # ( + ,
$$ % & a<(
% &
+ , - . /
789 is added to each element of 7a9
$$ c & a<%
c &
, . 0 11 1(
Both arrays 7a9 and 7b9 are added and stored in 9c9
$$ '15#5(5+) < ' 15#5(5+)
ans &
# + - /
It directly adds each elements of :st matri! #ith
;nd matri!
$$ '15#5(5+)=(
ans &
( - 0 1#
It multiplies each elements of ro# matri! #ith 8.
$$a=%
>>> Error 7sing &&$ ?ti?es
Inner ?atri1 9i?ensions ?7st agree.
It gives error as dimensions of matri! do not match
re<uirement for matri! multiplicaiton
$$a.=%
ans &
+ 10 1/ #/ +0
It directly multiplies each elements of :st matri!
#ith ;nd matri!
$$a=%@
ans &
100
It ?7ltiAlies a Bit6 transAose o8 % res7lt Bill %e
111 ?atri1
$$ a@=%
ans &
+ , - . /
/ 10 1# 1+ 1-
1# 1, 1/ #1 #+
1- #0 #+ #/ (#
#0 #, (0 (, +0
It ?7ltiAlies a transAose Bit6 % res7lt Bill %e ,1,
?atris
$$ '15#5(5+).C(
ans &
1 / #. -+
It ma=es cube of each elements of ro# matri!
$$c & a31:#4<i=%31:#4
ans &
1.0000 < +.0000i #.0000 < ,.0000i (
It generates comple! vecotr using t#o elements of
vector a and b and store it in c
$$c@
ans &
1.0000 " +.0000i
#.0000 " ,.0000i
It ta=es comple! con)ugate transpose as c is a
vector #ith comple! values.
$$B6o
Do7r Earia%les are:
a % ans c 1 2
isplays all variables used
$$ clear 1
Do7r Earia%les are:
a % ans c 2
clears the variable !
$$ clear all
clears all the variables
$$Ai
ans &
(.1+1-
>eserved variable for value of
$$ e2e3(4
ans &
1 0 0
0 1 0
0 0 1
?enerates identity matri!
$$ Feros3(5+4
Dars6an Instit7te o8 Engineering an9 Tec6nolog2 5 Ra:;ot
SUBJECT:
Digital Signal Processing
TITLE:
Review of MATLAB Basics
(
EXPERIMENT NO. 01
DATE :
DOC. CODE: DIET/MEEC
REV. NO.: 1.00/!NE"#01#
ans &
0 0 0 0
0 0 0 0
0 0 0 0
?enerates 8 ! @ matri! #ith all elements 7A9
$$ ones3#5+4
ans &
1 1 1 1
1 1 1 1
?enerates 8 ! @ matri! #ith all elements 7:9
$$ A&'1 # (*+ , -*. / 0)
A &
1 # (
+ , -
. / 0
$$ c & ' A* 10 11 1#)
c &
1 # (
+ , -
. / 0
10 11 1#
It appends a ro# in the matri! 7a9
$$ 'A* A* A)
ans &
1 # (
+ , -
. / 0
1 # (
+ , -
. / 0
1 # (
+ , -
. / 0
It appends 7a9 to itself one after another and forms
BC8 matri!
$$ G & ' A5A* A5A)
ans &
1 # ( 1 # (
+ , - + , -
. / 0 . / 0
1 # ( 1 # (
+ , - + , -
. / 0 . / 0
This appends matri! 7a9 on the both directions and
forms D C D matri!
$ 'roB5col)&siFe3G4
roB & - col & -
Identifies size of a matri! in terms of ro#s and
columns.
$$ 8in93G&&.4
ans &
(
-
#1
#+
>eturns linear inde! of a marti! #here the value of
element is E
$$ 8 & "1:0.#,:1
8 &
"1.0000 "0..,00 "0.,000 "0.#,00 0
0.#,00 0.,000 0..,00 1.0000
$$ ro7n9384
ans &
"1 "1 "1 0 0 0 1 1 1
>ounding around threshold of A.F
$$ ceil384
ans &
"1 0 0 0 0 1 1 1 1
Assign the closest higher interger #hile rounding
$$ 8loor384
ans &
"1 "1 "1 "1 0 0 0 0 1
Assign the closest lo#er interger #hile rounding
$$ s7?384
ans &
0
sum of all elements stored in matri!
$$lengt6384
ans &
+
?ives number of elements in a vector
$$ a & '1 #*( +)
a &
1 #
( +
$$ inE3a4
ans &
"#.0000 1.0000
1.,000 "0.,000
&alculates inverse of a matri!
Dars6an Instit7te o8 Engineering an9 Tec6nolog2 5 Ra:;ot
SUBJECT:
Digital Signal Processing
TITLE:
Review of MATLAB Basics
+
EXPERIMENT NO. 01
DATE :
DOC. CODE: DIET/MEEC
REV. NO.: 1.00/!NE"#01#
$$ 9et3a4
ans & "#
&alculates determinant value of matri!
"ome useful function for graphical representation
$$ t & 0 : 3#=Ai4/100 : #=Ai* Hgenerate a Eector t Bit6 101 Eal7es %etBeen '05#)
$$ 2 & sin3t4* Hgenerte Eecotr 2 %2 cal7clating sin o8 eac6 Eal7e in t 2 Bill also %e o8 101
Eal7es
$$ Alot3t524
GG stem+t,y,
$$ t & 0 : 3#=Ai4/100 : -=Ai*
$$ 21 & sin3t4*
$$ 2# & sin3t<Ai/(4*
$$ 2( & sin3t<#=Ai/(4*
$$ Alot3t5215t52#5t52(4
Dars6an Instit7te o8 Engineering an9 Tec6nolog2 5 Ra:;ot
SUBJECT:
Digital Signal Processing
TITLE:
Review of MATLAB Basics
,
EXPERIMENT NO. 01
DATE :
DOC. CODE: DIET/MEEC
REV. NO.: 1.00/!NE"#01#
$$ t & 0 : 3#=Ai4/100 : -=Ai*
$$ 21 & sin3t4*
$$ 2# & cos3t4*
$$ s7%Alot3#51514
$$ Alot3t5214
$$ s7%Alot3#515#4
$$ Alot3t52#4

$$ n&0:0.#,:,*
$$ ?&e1A3"n4*
$$ ste?3n5?4

$$ 1 & Aea;s3,04*
$$ ?es6314

Dars6an Instit7te o8 Engineering an9 Tec6nolog2 5 Ra:;ot
SUBJECT:
Digital Signal Processing
TITLE:
Review of MATLAB Basics
-
EXPERIMENT NO. 01
DATE :
DOC. CODE: DIET/MEEC
REV. NO.: 1.00/!NE"#01#
GRADE LAB-INCHARGE H.O.D.
Dars6an Instit7te o8 Engineering an9 Tec6nolog2 5 Ra:;ot

Vous aimerez peut-être aussi