BS Lab Manuals

Download as pdf or txt
Download as pdf or txt
You are on page 1of 49

Basic Simulation Lab

Experiment No-1

BASIC OPERATIONS ON MATRICES

AIM - To write a MATLAB program to perform some basic operation on matrices such as addition, subtraction, multiplication. SO!T"ARE RE#$RIE% MATLAB R200 !".# $ersion%. PROCE%$RE &pen MATLAB &pen new M-file T'pe the program (a)e in current director' *ompile and Run the program +or the output see command window, +igure window

PRO&RAM clcclose allclear alla./0 2 -1 - 2 -0 2- # -2 #3b./0 2 #- 2 4 - " 5 13disp!6The matri7 a. 6%-a disp!6The matri7 b. 6%-b 8 to find sum of a and b c.a9bdisp!6The sum of a and b is 6%-c 8 to find difference of a and b d.a-bdisp!6The difference of a and b is 6%-d 8to find multiplication of a and b e.a:bdisp!6The product of a and b is 6%-e 8 to find element-b'-element multiplication RES$LT +inding addition, subtraction, multiplication using Matlab was (uccessfull' completed

%ept o' ECE( S)CET

Basic Simulation Lab

O$TP$T The matri7 a. a. 0 2 # 2 -1 -0 2 -2 #

The matri7 b. b. 0 2 " 2 4 5 # 1

The sum of a and b is c. 2 00 2 2 5 2 02

The difference of a and b is d. 0 0 -02 -2 -2 -2 -02 The product of a and b is e. -42 - 0 02 04 05 5 00 02

%ept o' ECE( S)CET

Basic Simulation Lab

Experiment No-*a

&ENERATION O! %ISCRETE SI&NALS


AIM -To write a ;MATLAB< =rogram to generate of discrete time signals li>e unit impulse, unit step, unit ramp, e7ponential signal and sinusoidal signals. SO!T"ARE RE#$RIE% ?MATLAB R200 b !".# $ersions% PROCE%$RE &pen MATLAB &pen new M-file T'pe the program (a)e in current director' *ompile and Run the program +or the output see command window, +igure window

PRO&RAM clcclear allclose alln.-00?0?00L.length!n%for i.0?L if n!i%..0 70!i%.0else 70!i%.0endif n!i%@.0 72!i%.07#!i%.n!i%else 72!i%.07#!i%.0endend8 to generate e7ponential seAuence a.0.5472.a.Bn8 to generate sinusoidal seAuence f.0.074.sin!2:pi:f:n%figure-

%ept o' ECE( S)CET

Basic Simulation Lab

subplot!#,2,0%stem!n,70%7label!6time n ----@6%'label!6amplitude----@6%title!6Cnit step signal6%subplot!#,2,2%stem!n,72%-7label!6time n ----@6%'label!6amplitude----@6%title!6Cnit impluse signal6% subplot!#,2,#%stem!n,7#%7label!6time n ----@6%'label!6amplitude----@6%title!6Cnit remp signal6%subplot!#,2,2%stem!n,72%-7label!6time n ----@6%'label!6amplitude----@6%title!6e7ponential signal6%subplot!#,2,/4, 3%stem!n,74%7label!6time n ----@6%'label!6amplitude----@6%title!6sinusoidal signal6%RES$LT Thus the Deneration of discrete time signals li>e unit impulse, unit step, unit ramp, e7ponential signal and sinusoidal signals was successfull' *ompleted. O$TP$T -

%ept o' ECE( S)CET

Basic Simulation Lab

%ept o' ECE( S)CET

Basic Simulation Lab

Experiment No-*b

&ENERATION O! CONTIN$O$S SI&NALS


AIM -To write a ;MATLAB< =rogram to generate of continuous time signals li>e unit step, sawtooth, triangular, (inusoidal, ramp, and sinc function. SO!T"ARE RE#$RIE% ? MATLAB R200 b !".# $ersions% . PROCE%$RE &pen MATLAB &pen new M-file T'pe the program (a)e in current director' *ompile and Run the program +or the output see command window, +igure window

PRO&RAM clc*lear all*lose allt.-00?0.00?00L.length!t%for i.0?L 8to generate unit (tep and ramp function if t!i%E0 70!i%.072!i%.0else 70!i%.072!i%.t!i%endend8to generate sinusoidal function f.0.07#.sin!2:pi:f:t%8to generate Triangular and (awtooth wa)eforms 72.sawtooth!t,0.4%74.sawtooth!t%8to generate sinc function 7 .sinc!t%figuresubplot!2,#,0%-

%ept o' ECE( S)CET

Basic Simulation Lab

plot!t,70%7label!6t---@6%-'label!6amp---@6%title!6unit step6%subplot!2,#,2%plot!t,72%7label!6t---@6%-'label!6amp---@6%title!6unit ramp6%subplot!2,#,#%plot!t,7#%7label!6t---@6%-'label!6amp---@6%title!6sinusoidal6%subplot!2,#,2%plot!t,72%7label!6t---@6%-'label!6amp---@6%title!6triangular6%subplot!2,#,4%plot!t,74%7label!6t---@6%-'label!6amp---@6%title!6sawtooth6%subplot!2,#, %plot!t,7 %7label!6t---@6%-'label!6amp---@6%title!6sinc function6%RES$LT Thus the Deneration of continuous time signals li>e unit step, sawtooth, triangular, sinusoidal, ramp and sinc functions are successfull' completed. O$TP$T -

"

%ept o' ECE( S)CET

Basic Simulation Lab

%ept o' ECE( S)CET

Basic Simulation Lab

Experiment No-+,

OPERATIONS ON SI&NALS AN% SE#$ENCES


AIM - To perform )arious operations on signals such as addition, multiplication, scaling, shifting and folding, computation of energ' and a)g power using MATLAB program.. SO!T"ARE RE#$RIE% ?MATLAB R200 b !".# $ersions% . PROCE%$RE &pen MATLAB &pen new M-file T'pe the program (a)e in current director' *ompile and Run the program +or the output see command window, +igure window

PRO&RAM clc, close allclear allt.0?0.000?0L.length!t%f0.0f2.#70.sin!2:pi:f0:t%72.sin!2:pi:f2:t%figuresubplot!#,2,0%plot!t,70,6b6,t,72,6r6%title!6the signals 70!t% and 72!t%6%7#.70972subplot!#,2,2%plot!t,7#%title!6the sum of 70!t% and 72!t%6%72.70.:72subplot!#,2,#%plot!t,72%title!6the multiplication of 70!t% and 72!t%6%t.-0?0.000?074.sin!2:pi:f0:!-t%%7 .sin!2:pi:f2:!-t%%-

%ept o' ECE( S)CET

Basic Simulation Lab

subplot!#,2,2%plot!t,74,6b6,t,7 ,6r6%title!6the folding of 70!t%and 72!t%6%7"./Feros!0,200%,72!0?!L-200%%3subplot!#,2,4%plot!t,7"%title!6the shifting of 70!t%and 72!t%6%75.72.B2subplot!#,2, %plot!t,75%title!6the sAuaring of 70!t%and 72!t%6%RES$LT Thus the MATLAB =rogram to perform some operations on signals was completed successfull'. O$TP$T -

00

%ept o' ECE( S)CET

Basic Simulation Lab

Experiment No--

E)EN AN% O%% PART O! A SI&NAL


AIM - To write a MATLAB program to finding the e)en and odd parts of a signal. SO!T"ARE RE#$RIE% ?MATLAB R200 b !".# $ersions% . PROCE%$RE &pen MATLAB &pen new M-file T'pe the program (a)e in current director' *ompile and Run the program +or the output see command window, +igure window

PRO&RAM clcclear allclose allt.-4?0.000?4A.0.570.A.B!t%72.A.B!-t%if!72..70% disp!6The gi)en signal is e)en signal6%else if!72..!-70%% disp!6The gi)en signal is odd signal6%else disp!6The gi)en signal is neither e)en nor odd6%end end 7e.!70972%G27o.!70-72%G2subplot!2,2,0%plot!t,70%7label!6t6%-'label!67!t%6%-title!6signal 7!t%6%subplot!2,2,2%plot!t,72%7label!6t6%-'label!67!t%6%-title!6signal 7!-t%6%subplot!2,2,#%plot!t,7e%-

00

%ept o' ECE( S)CET

Basic Simulation Lab

7label!6t6%-'label!67!t%6%-title!6e)en part signal 7!t%6%subplot!2,2,2%plot!t,7o%7label!6t6%-'label!67!t%6%-title!6odd part signal 7!t%6%RES$LT Thus the MATLAB =rogram to find e)en and odd parts of signals was completed successfull'. O$TP$T -

02

%ept o' ECE( S)CET

Basic Simulation Lab

Experiment No-.

CON)OL$TION O! T"O SE#$ENCES


AIM - To write a MATLAB program to find the con)olution of two seAuences. SO!T"ARE RE#$RIE% ?MATLAB R200 b !".# $ersions% . PROCE%$RE &pen MATLAB &pen new M-file T'pe the program (a)e in current director' *ompile and Run the program +or the output see command window, +igure window

PRO&RAM clcclear allclose alln.0?570.072.0'0.70.:[email protected] H nE.2%972.:[email protected] H nE.5%subplot!2,2,0%stem!n,'0%a7is!/0 5 0 0.43%7label!6time n ----@6%'label!6amplitude----@6%title!6the seAuence '0/n36% '2.70.:[email protected] H nE.2%972.:[email protected] H nE.5%subplot!2,2,2%stem!n,'2%a7is!/0 5 0 0.43%7label!6time n ----@6%'label!6amplitude----@6%title!6the seAuence '2/n36% '.con)!'0,'2%L.length!'%n.0?L-0subplot!2,2,/#,23%stem!n,'%a7is!/0 00 0 23%7label!6time n ----@6%-

0#

%ept o' ECE( S)CET

Basic Simulation Lab

'label!6amplitude----@6%title!6the con)olution seAuence of '0/n3H'2/n36%RES$LT Thus the MATLAB =rogram to finding the con)olution of two seAuences is completed successfull'. O$TP$T -

02

%ept o' ECE( S)CET

Basic Simulation Lab

Experiment No-+/

A$TO-CORRELATION 0 CROSS-CORRELATION BET"EEN SI&NALS


AIM - To write a matlab program to compute autocorrelation and cross correlation between signals. SO!T"ARE RE#$RIE% ?MATLAB R200 b !".# $ersions% .PROCE%$RE PRO&RAM clc- clear all- close allt.0?0.00?0f0.#70.sin!2:pi:f0:t%figuresubplot!2,0,0%plot!t,70%title!6sine wa)e6%7label!6time ----@6%'label!6amplitude----@6%grid/r77 lag03.7corr!70%subplot!2,0,2%plot!lag0,r77%gridtitle!6auto-correlation function of sine wa)e6%figuresubplot!2,2,0%plot!t,70%title!6sine wa)e 706%7label!6time ----@6%'label!6amplitude----@6%gridf2.272.sin!2:pi:f2:t%&pen MATLAB &pen new M-file T'pe the program (a)e in current director' *ompile and Run the program +or the output see command window, +igure window

04

%ept o' ECE( S)CET

Basic Simulation Lab

subplot!2,2,2%plot!t,72%title!6sine wa)e 726%7label!6time ----@6%-,'label!6amplitude----@6%grid/c77 lag23.7corr!70,72%subplot!2,2,/#,23%plot!lag2,c77%gridtitle!6cross-correlation function of sine wa)e6%RES$LT Thus the MATLAB =rogram of computing auto correlation and cross correlation between signals was completed successfull'.

&CT=CT?

%ept o' ECE( S)CET

Basic Simulation Lab

0"

%ept o' ECE( S)CET

Basic Simulation Lab

Experiment No-12a3

LINEAR S4STEM OR NON-LINEAR S4STEM


AIM - To write a matlab program to )erif' the gi)en s'stem is linear or non-linear. SO!T"ARE RE#$RIE% ?MATLAB R200 b !".# $ersions% PROCE%$RE &pen MATLAB &pen new M-file T'pe the program (a)e in current director' *ompile and Run the program +or the output see command window, +igure window

PRO&RAM -

clc- clear all- close all70.input!6enter the 70/n3 seAuence.6%- 8 /0 2 2 3 72.input!6enter the 72/n3 seAuence.6%- 8 /# 4 -2 -43 if length!70%I.length!72% disp!6 length of 72 must be eAual to the length of 706%returnendh.input!6enter the h/n3 seAuence.6%-8 /-0 0 -# -0 2 03 a.input!6enter the constant a. 6%- 8 2 b.input!6enter the constant b. 6%- 8 # '00.con)!a:70,h%'02.con)!b:72,h%'0.'009'027.a:709b:72'2.con)!7,h%L.length!70%9length!h%-0n.0?L-0subplot!2,0,0%stem!n,'0%label!6n ---@6%- label!6amp ----@6%title!6sum of the indi)idual response6%subplot!2,0,2%stem!n,'2%7label!6n ---@6%- 'label!6amp ----@6%title!6total response6%if '0..'2 disp!6the s'stem is a Linear s'stem6%else

05

%ept o' ECE( S)CET

Basic Simulation Lab

disp!6the s'stem is a non-linear s'stem6%endRES$LT Thus the MATLAB =rogram of )erif'ing the s'stem is linear or non linear b' using matlab has performed. INP$T SE#$ENCE Jnter the 70/n3 seAuence. /0 2 2 3 Jnter the 72/n3 seAuence. /# 4 -2 -43 Jnter the h/n3 seAuence. /-0 0 -# -0 2 03 Jnter the constant a. 2 H enter the constant b. # The s'stem is a linear s'stem O$TP$T -

Experiment No-+12b3

01

%ept o' ECE( S)CET

Basic Simulation Lab

TIME-IN)ARIANT OR TIME-)ARIANT S4STEM


AIM - To write a matlab program to )erif' the gi)en s'stem is Time Kin)ariant or TimeK)ariant. SO!T"ARE RE#$RIE% ?MATLAB R200 b !".# $ersions% PROCE%$RE &pen MATLAB &pen new M-file T'pe the program (a)e in current director' *ompile and Run the program +or the output see command window, +igure window

PRO&RAM clc- clear all- close all7.input!6enter the seAuence 7/n3.6%- 8/0 2 # 0 -2 " #3 h.input!6enter the seAuence h/n3.6%- 8/2 -4 -00 -# " 2 5 -043 d.input!6enter the positi)e number for dela' d.6%- 8 4 7dn./Feros!0,d%,738 dela'ed input 'n.con)!7dn,h%8 output for dela'ed input '.con)!7,h%8 actual output 'dn./Feros!0,d%,'38 dela'ed output figuresubplot!2,0,0%stem!0?length!7%-0,7%7label!6n ----@6%,'label!6amp ---@6%title!6the seAuence 7/n3 6%subplot!2,0,2%stem!0?length!7dn%-0,7dn%7label!6n ----@6%,'label!6amp ---@6%title!6the dela'ed seAuence of 7/n3 6%figuresubplot!2,0,0%stem!0?length!'n%-0,'n%7label!6n ----@6%,'label!6amp ---@6%title!6the response of the s'stem to the dela'ed seAuence of 7/n3 6%subplot!2,0,2%stem!0?length!'dn%-0,'dn%7label!6n ----@6%,'label!6amp ---@6%title!6the dela'ed output seAuence 6%if 'n..'dn disp!6the gi)en s'stem is a Time-in)arient s'stem6%-

20

%ept o' ECE( S)CET

Basic Simulation Lab

else disp!6the gi)en s'stem is a Time-)arient s'stem6%endRES$LT Thus the MATLAB =rogram of )erif'ing the s'stem is Time Kin)ariant or TimeK)ariant ('stem b' using matlab has performed. INP$T SE#$ENCE Jnter the seAuence 7/n3 . /0 2 # 0 -2 " #3 Jnter the seAuence h/n3 . /2 -4 -00 -# " 2 5 -043 Jnter the positi)e number for dela' d.4 The gi)en s'stem is a Time-in)ariant s'stem O$TP$T -

20

%ept o' ECE( S)CET

Basic Simulation Lab

Experiment No-+5

22

%ept o' ECE( S)CET

Basic Simulation Lab

IMP$LSE RESPONSE AN% STEP RESPONSE


AIM - To write a matlab program to find the impulse responseH step response of the LTL s'stem go)erned b' the transfer function M!s% .0G( 2s9#. SO!T"ARE RE#$RIE% ?MATLAB R200 b !".# $ersions% .PROCE%$RE &pen MATLAB &pen new M-file T'pe the program (a)e in current director' *ompile and Run the program +or the output see command window, +igure window

PRO&RAM clcclear allclose alls'ms s comple7M.0G!sB292:s9#%disp!6Lmpulse response of the s'stem h!t% is6%h.ilaplace!M%simplif'!h%disp!h%N.0G!s:!sB292:s9#%%disp!6(tep response of the s'stem is6%'.ilaplace!N%simplif'!'%disp!'%t.0?0.0?20h0.subs!h,t%subplot!2,0,0%plot!t,h0%7label!6time6%'label!6h!t%6%title!6Lmpulse response of the s'stem6%'0.subs!',t%subplot!2,0,2%plot!t,'0%7label!6time6%'label!67!t%6%title!6step response of the s'stem6%-

2#

%ept o' ECE( S)CET

Basic Simulation Lab

RES$LT Thus the Deneration of impulse response H step response of the LTL s'stem is completed. O$TP$T Lmpulse response of a s'stem h !t% is e7p !-2:t%:sinh !t%. The step response of a s'stem is 0G :e7p !-#:t%-0G2:e7p !-t% 90G#.

&CT=CT?

Experiment No-6

22

%ept o' ECE( S)CET

Basic Simulation Lab

&IBBS P7ENOMENON
AIM - To write a MATLAB program to construct the following p periodic signal represented b' its +ourier (eries b' considering onl' #,1,41 terms. SO!T"ARE RE#$RIE% ?MATLAB R200 b !".# $ersions% . PROCE%$RE &pen MATLAB &pen new M-file T'pe the program (a)e in current director' *ompile and Run the program +or the output see command window, +igure window

PRO&RAM clcclear allclose allO.input!6enter the no. of signals to reconstruct.6%nPhar.input!6enter the no. of harmonics in each signal.6%t.-0?0.000?0omegaP0.2:pifor >.0?O 7.0.4for n.0?2?nPhar!>% bPn.2G!n:pi%7.79bPn:sin!n:omegaP0:t%end subplot!O,0,>%plot!t,7%7label!6time---@6%'label!6amp----@6%a7is!/-0 0 -0.4 0.43%te7t!0.44,0.0,/6no.of har.6,num2str!nPhar!>%%3%end RES$LT - Thus, the operation to perform Dibbs =henomenon is successfull' completed.

O$TP$T -

24

%ept o' ECE( S)CET

Basic Simulation Lab

enter the no. of signals to reconstruct.# enter the no. of harmonics in each signal./#,4,413

%ept o' ECE( S)CET

Basic Simulation Lab

Experiment No-1+2a3

!O$RIER TRANS!ORMS AN% IN)ERSE !O$RIER TRANS!ORMS


AIM - To find +ourier transform and in)erse +ourier transforms of gi)en functions. SO!T"ARE RE#$RIE% ?MATLAB R200 b !".# $ersions% . PROCE%$RE . &pen MATLAB &pen new M-file T'pe the program (a)e in current director' *ompile and Run the program +or the output see command window, +igure window

PRO&RAM To 'in8 !ourier trans'orm clc- clear all- close alls'ms t s-s'ms w reals'ms A real-s'ms o real-s'ms b floatf.dirac!t%+.fourier!f%disp!6the fourier transform of dirac!t% .6%disp!+%f0.A:hea)iside!t%+0.fourier!f0%disp!6the fourier transform of A .6%disp!+0%f2.A:e7p!-t%:hea)iside!t%+2.fourier!f2%disp!6the fourier transform of e7p!-t% .6%disp!+2%f#.A:t:e7p!-b:t%:hea)iside!t%+#.fourier!f#%disp!6the fourier transform of A:t:e7p!-b:t%:u!t% .6%disp!+#%f2.sin!o:t%+2.fourier!f2%disp!6the fourier transform of sin!o:t% .6%disp!+2%-

2"

%ept o' ECE( S)CET

Basic Simulation Lab

To 'in8 in9erse !ourier trans'orms o' &i9en 'unctions: +0.A:pi:!dirac!w-o%9dirac!w9o%%f0.ifourier!+0,t%disp!6the in)erse fourier transform of A:pi:!dirac!w-o%9dirac!w9o%.6%disp!f0%+2.A:pi:!dirac!w-o%-dirac!w9o%%Gif2.ifourier!+2,t%disp!6the in)erse fourier transform of A:pi:!dirac!w-o%9dirac!w9o%Gi.6%disp!f2%+#.AG!09i:w%f#.ifourier!+#,t%disp!6the in)erse fourier transform of AG!09Qw%.6%disp!f#%+2.!#:i:w902%G!!i:w%B29":i:w902%f2.ifourier!+2,t%disp!6the in)erse fourier transform of !#:i:w902%G!!i:w%B29":i:w902%.6%disp!f2%RES$LT - Thus the MATLAB program to find fouries transform and in)erse fouries transform of gi)en functions is successfull' completed. O$TP$T the fourier transform of dirac!t% .0 the fourier transform of A .A:!pi:dirac!w%-iGw% the fourier transform of e7p!-t% . AG!09i:w% the fourier transform of A:t:e7p!-b:t%:u!t% . AG!b9i:w%B2 the fourier transform of sin!o:t% . i:pi:!dirac!w9o%-dirac!w-o%% the in)erse fourier transform of A:pi:!dirac!w-o%9dirac!w9o%. A:cos!o:t% the in)erse fourier transform of A:pi:!dirac!w-o%9dirac!w9o%Gi. A:sin!o:t% the in)erse fourier transform of AG!09Qw%. A:e7p!-t%:hea)iside!t% the in)erse fourier transform of !#:i:w902%G!!i:w%B29":i:w902%. hea)iside!t%:!-2:e7p!-2:t%94:e7p!-#:t%%

25

%ept o' ECE( S)CET

Basic Simulation Lab

Experiment no-1+2b3

MA&NIT$%E AN% P7ASE SPECTR$M O! !O$RIER TRANS!ORMS


AIM -. To find +ourier transform of the gi)en signal and to plot its magnitude and phase spectrum. SO!T"ARE RE#$RIE% ?MATLAB R200 b !".# $ersions% . PROCE%$RE &pen MATLAB &pen new M-file T'pe the program (a)e in current director' *ompile and Run the program +or the output see command window, +igure window

PRO&RAM clc- clear all- close alls'ms t s s'ms w floatf.#:e7p!-t%:hea)iside!t%8 gi)en function +.fourier!f%8 to find +ourier Transform disp!6the fourier transform of #:e7p!-t%:u!t% .6%disp!+%8 to displa' the result in the command window w.-2:pi?piG40?2:pi+0.subs!+,w%8 substitute w in + function +mag.abs!+0%8 to find magnitude +phas.angle!+0%8 to find phase subplot!2,0,0%plot!w,+mag%7label!6w ----@6%'label!6Magnitude ---@6%title!6Magnitude spectrum6%gridsubplot!2,0,2%plot!w,+phas%7label!6w ----@6%'label!6=hase in radians---@6%title!6=hase spectrum6%gridRES$LT - Thus the MATLAB program to find fouries transform and ploting magnitude and =hase spectrums is successfull' completed.

21

%ept o' ECE( S)CET

Basic Simulation Lab

O$TP$T The fourier transform of #:e7p !-t%:u !t% . #G!09i:w%

Experiment no-11

#0

%ept o' ECE( S)CET

Basic Simulation Lab

LAPLACE TRANS!ORM
AIM -. MATLAB program to plot the gi)en wa)eform using wa)eform s'nthesis using Laplace transform. . SO!T"ARE RE#$RIE% ?MATLAB R200 b !".# $ersions% . PROCE%$RE &pen MATLAB (oftware &pen new M-file T'pe the program (a)e in current director' Run the program +or the output see command window, +igure window.

PRO&RAM clcclose alls'ms s+ .!0G!sB2%%:!0-e7p!-s%-!0G2%:e7p!-#:s%9!0G2%:e7p!-4:s%%f.ilaplace!+%prett'!simplif'!f%% eFplot!f,/0,43%grid-

RES$LT - Thus the MATLAB program the gi)en wa)eform is plotted b' using wa)e form s'nthesis is successfull' completed O$TP$T -

#0

%ept o' ECE( S)CET

Basic Simulation Lab

#2

%ept o' ECE( S)CET

Basic Simulation Lab

Experiment No-1*2a3 ;EROS AN% POLES IN S- PLANE AIM -. To Rrite a MATLAB program to draw =ole-Sero map in (-=lane SO!T"ARE RE#$RIE% ? MATLAB R200 b !".# $ersions% . PROCE%$RE &pen MATLAB (oftware &pen new M-file T'pe the program (a)e in current director' Run the program +or the output see command window, +igure window. PRO&RAM clc- clear all- close allnum.input!6enter the numerator pol'nomial )ector,n6%- 8 /0 -2 03 den.input!6enter the denominator pol'nomial )ector,n6%- 8 /0 00 3 M.tf!num,den% /p F3.pFmap!M%disp!6Feros are at 6%disp!F%disp!6poles are at 6%disp!p%pFmap!M%if ma7!real!p%%@.0 disp!6 All the poles do not lie in the left half of (-plane 6%disp!6 the gi)en LTL s'sten is not a stable s'stem 6%else disp!6All the poles lie in the left half of (-plane 6%disp!6 the gi)en LTL s'sten is a stable s'stem 6%endRES$LTS - Thus the MATLAB program to draw pole-Fero map in (-plane is successfull' completed. O$TP$T Jnter the numerator pol'nomial )ector /0 -2 03 Jnter the denominator pol'nomial )ector /0 00 3 Transfer function?

##

%ept o' ECE( S)CET

Basic Simulation Lab

sB2 - 2 s 9 0 ---------------------sB# 9 sB2 9 00 s 9 Seros are at 0 0 =oles are at -#.0000 -2.0000 -0.0000 All the poles lie in the left half of (-plane The gi)en LTL s'sten is a stable s'stem

#2

%ept o' ECE( S)CET

Basic Simulation Lab

#4

%ept o' ECE( S)CET

Basic Simulation Lab

Experiment no-1*2b3 ;EROS AN% POLES IN ;- PLANE AIM -. To Rrite a MATLAB program to draw =ole-Sero map in S-=lane SO!T"ARE RE#$RIE% ?MATLAB R200 b !".# $ersions% . PROCE%$RE &pen MATLAB (oftware &pen new M-file T'pe the program (a)e in current director' Run the program +or the output see command window, +igure window.

PRO&RAM clc- clear all- close allnum.input!6enter the numerator pol'nomial )ector ,n6%- 8/0 0 03 den.input!6enter the denominator pol'nomial )ector ,n6%-8/0 0 0.0 3 M.filt!num,den% F.Fero!M%disp!6the Feros are at 6%disp!F%/r p >3.residueF!num,den%disp!6the poles are at 6%disp!p%Fplane!num,den%title!6=ole-Sero map in the S-plane6%if ma7!abs!p%%@.0 disp!6all the poles do not lie with in the unit circle6%disp!6hence the s'stem is not stable6%else disp!6all the poles lie with in the unit circle6%disp!6hence the s'stem is stable6%endRES$LTS - Thus the MATLAB program to draw pole-Fero map in (-plane is successfull' completed.

%ept o' ECE( S)CET

Basic Simulation Lab

O$TP$T Jnter the numerator pol'nomial )ector /0 0 03 Jnter the denominator pol'nomial )ector /0 0 0.0 3 Transfer function? 0 -------------------0 9 FB-0 9 0.0 FB-2 The Feros are at 0 0 The poles are at -0.5000 -0.2000 All the poles lie with in the unit circle Mence the s'stem is stable

#"

%ept o' ECE( S)CET

Basic Simulation Lab

Experiment no-1,

&A$SSIAN NOISE
AIM -. To generate a Daussian noise and to compute its Mean, Mean (Auare $alue, (>ew, Turtosis, =(U, =robabilit' Uistribution function. SO!T"ARE RE#$RIE% ?MATLAB R200 b !".# $ersions% . PROCE%$RE &pen MATLAB (oftware &pen new M-file T'pe the program (a)e in current director' Run the program +or the output see command window, +igure window.

PRO&RAM clc- clear all- close allt.-00?0.00?00L.length!t%n.randn!0,L%subplot!2,0,0%plot!t,n%7label!6t ---@6%,'label!6amp ----@6%title!6normal randon function6%nmean.mean!n%disp!6mean.6%-disp!nmean%nmeansAuare.sum!n.B2%Glength!n%disp!6mean sAuare.6%-disp!nmeansAuare%nstd.std!n%disp!6std.6%-disp!nstd%n)ar.)ar!n%disp!6)ar.6%-disp!n)ar%ns>ew.s>ewness!n%disp!6s>ew.6%-disp!ns>ew%n>urt.>urtosis!n%disp!6>urt.6%-disp!n>urt%p.normpdf!n,nmean,nstd%subplot!2,0,2%-

#5

%ept o' ECE( S)CET

Basic Simulation Lab

stem!n,p% RES$LTS - Thus To generate Daussian noise and to compute its Mean, Mean (Auare $alue, (>ew, Turtosis, =(U, =robabilit' Uistribution function is performed.

O$TP$T Mean< 6:*/1/e-++Mean s=uare< +:611. ST%< +:6556 )ar< +:615+ S>e?< -+:++61 @urt< *:6.*+

#1

%ept o' ECE( S)CET

Basic Simulation Lab

20

%ept o' ECE( S)CET

Basic Simulation Lab

Experiment No-1-

SAMPLIN& T7EOREM
AIM -. To generate a MATLAB =rogram to )erif' sampling theorem: SO!T"ARE RE#$RIE% ?MATLAB R200 b !".# $ersions% . PROCE%$RE &pen MATLAB (oftware &pen new M-file T'pe the program (a)e in current director' Run the program +or the output see command window, +igure window.

PRO&RAM clcclose allclear allf0.#f2.2#t.-0.2?0.0000?0.27.cos!2:pi:f0:t%9cos!2:pi:f2:t%figure!0%plot!t,7,6-.r6%7label!6time-----6%'label!6amp---6%title!6The original signal6%8case 0? !fsE2fm% fs0.0.2:f2ts0.0Gfs0n0.-0.2?ts0?0.27s0.cos!2:pi:f0:n0%9cos!2:pi:f2:n0%figure!2%stem!n0,7s0%hold onplot!t,7,6-.r6%hold offlegend!6fsE2fm6%8case 2? !fs.2fm%

20

%ept o' ECE( S)CET

Basic Simulation Lab

fs2.2:f2ts2.0Gfs2n2.-0.2?ts2?0.27s2.cos!2:pi:f0:n2%9cos!2:pi:f2:n2%figure!#%stem!n2,7s2%hold onplot!t,7,6-.r6%hold offlegend!6fs.2fm6%8case #? !fs@2fm% fs#.":f2ts#.0Gfs#n#.-0.2?ts#?0.27s#.cos!2:pi:f0:n#%9cos!2:pi:f2:n#%figure!2%stem!n#,7s#%hold onplot!t,7,6-.r6%hold offlegend!6fs@2fm6%-

RES$LTS Thus the MATLAB program to )erif' (ampling theorem is performed.

22

%ept o' ECE( S)CET

Basic Simulation Lab

O$TP$T

2#

%ept o' ECE( S)CET

Basic Simulation Lab

22

%ept o' ECE( S)CET

Basic Simulation Lab

24

%ept o' ECE( S)CET

Basic Simulation Lab

%ept o' ECE( S)CET

Basic Simulation Lab

Experiment no-1.

A$TO-CORRELATIONACROSS-CORRELATION
AIM -. To write a program to detect the periodic signal b' Ooise using Auto correlation and *ross *orrelation method. SO!T"ARE RE#$RIE% ?MATLAB R200 b !".# $ersions% . PROCE%$RE &pen MATLAB (oftware &pen new M-file T'pe the program (a)e in current director' Run the program +or the output see command window, +igure window.

PRO&RAM clcclear allclose allt.0?0.00?00s.cos!2:pi:#:t%9sin!2:pi:4:t%- 8 periodic signal figuresubplot!2,0,0%plot!t,s%a7is!/0 00 -2 23%7label!6 t ----@6%,'label!6 amp ----@ 6%title!6the periodic signal6%L.length!t%n.randn!0,L%- 8 noise signal subplot!2,0,2%plot!t,n%7label!6 t ----@6%,'label!6 amp ----@ 6%title!6the noise signal6%L.length!t%f.s9n- 8 recei)ed signal figuresubplot!2,0,0%plot!t,f%7label!6 t ----@6%,'label!6 amp ----@ 6%title!6the recei)ed signal6%r77.7corr!f,s,200%-

2"

%ept o' ECE( S)CET

Basic Simulation Lab

subplot!2,0,2%plot!r77%title!6the *orrelator output6%RES$LTS - Thus the MATLAB =rogram to detect the periodic signal mas>ed b' noise using Auto *orrelation H*ross *orrelation method is performed.

O$TP$T

25

%ept o' ECE( S)CET

Basic Simulation Lab

21

%ept o' ECE( S)CET

You might also like