Partial preview of the text
Download Signal and system experiment notes and more Summaries Family and Consumer Science in PDF only on Docsity!
wi o EE FOSS SESODOHHEHHOKOHHEEMMLELSLH$L} SIGNALS AND SYSTEMS LAB LIST OF EXPERIMENT 1. Introduction to MATLAB and its basic commands. 2. To plot unit step, unit impulse, unit ramp, exponential, parabolic functions and sinusoidal signals. 3. To write program using MATLAB which plot convolution of two numbers. 4. To write a program which plot correlation of two sequences, 5. Plot the magnitude and phase of a signal using Fourier Transformation. 6. Find out the Z transform of a signal. 7. To plot Laplace Transformation of signal. 8. Plot the spectra a of ideally sampled signal w.r.t. sampling of discrete time signals. 9. To find and plot the auto and cross-correlation of two sequences. 10. _—_‘ To find frequency response of given system in differential equation form. é « SFE ECC OOEEEEEEEES Basic Commands Experiment — | Aim: 1 : Int i Aim: Introduction of Matlab and its basic commands. Theory: MATLAB is a hi poeaatin is a high-performance language for tochnical computing. integrals’ problem: Hon, visualization, and programming in an easy-to-use onvironment West: s and solutions are expressed in familiar mathornatical notation. Tl ; ; 7 he name MATLAB stands for matrix laboratory. MATLAB vis originally ueittan Provide easy access to matrix. Desktop Tools 4- Command Window: Use the Command Window functions and M-files. 2- Command History: Statements you enter in the Command Window are logs ind History, you can view previously run the Command History. In the Comma te selected statements. statements, and copy and execu 3- Current Directory Browser: MATLAB file operations use the current directory reference point. Any file you want to run must be in the current directory or on the search path. 4-Workspace: The arrays) built up durin 5- Editor/Debugger (shown below). to enter variables and run eS itt MATLAB workspace consists of the set of variables (named g a MATLAB session and stored in memory. Window: Use the Editor/Debugger to create and debug M-files bles from workspace. dow and homes the cursor. help Command: help displays help about that Topic if it exist. Command: Provides help by searching through all the first contains a key word clear Command: Removes all varia cle Command: Clears the Command wint . ° ° e lookfor lines of MATLAB help topics and returning those that you specify. edit Command: enable you to edit (open) any M-file in Editor Window. d doesn't open built-in function like, sqrt. S e ee also type This comman' Command. * more command: m MATLAB command wind the MATLAB command window. ore on enables paging of the output in the ow, and more off disables paging of the output ia nme me i citbhh: Mn nn AA RA 66 ~~ @ © J c) = D 2 9 ) ) SCPSSPEKCHISIEK GES sc’ for square. ‘o’ for circle etc. Thus plot (x,y,"__ sc’) gives a dashed cyan dashed. plot(x,y,'oc’) gives cyan circles with no lines CONDITION STATEMENTS AND LOOPS These are statements that enable you to write code t! conditions e.g. if n<10 or code that will execute repea’ executed only certain hat will be 022<10. tedly e.g. while Syntax: 1 condition; If (logical expression) eg if n<10 (code to evaluate if expression is true) end 1. Loops for(range of values) e.g. b=0 (code to be evaluate for each value) for x=1:20 b=b+x end. while(logical expression) . e.g. x=1 (code to be evaluated while expression is true) while(x<100) x=2x end LOGICAL EXPRESSIONS These combine statements which evaluate either true or false(x<=10 etc) with the logical operators and logical AND; OR and NOT. ro NOTE :'==' -> testing for value : '=‘'-> assign values (R to C) e.g X<10 and y= =4 -> xis less than 10 and y equals to 4. x+y>=100 | |x+y<50 (x+y is greater than or equal to 100 or less than not equals to y) 50 and x does SUBPLOT FUNCTIONS Subplot divides the current figure into rectangular parts that are n each plane contains on axes, subsequent plots are output to current plane Syntax : subplot(m,n,p) lumbered row-wise subplot(m,n,p’x palce’) subplot(n) Subplot(position; [left bottom width height 7] n=subplol(...) ANGLE/PHASE ANGLE FUNCTION A complex matrix. It displays the phase angle or the angle of a given © Syntax : each element of complex peangle(z) ->Returns the phase angle in radians for array z this angle lies between +17. Source Code: cle clear all close all a=(34 56) b=[1213 14 15}; 9%"; "used to suppress printing of result c=a+b %perform addition d=a-b % perform subscription e-a*b % perform matrix multiplication f=a.*b % perform scalar multiplication g=a/b % perform matrix division he=a/b % perform scalar division ize % transpose of matrix e sqrim (c) % principal square root of the matrix c i.e, X*X =A det (i) % determinant of matrix i Secreates a square matrix of order 2x2 Result We study the basic commands of Matlab, and also familiar with its user interface. ys Pa woe 6 bbddddd SOOO OO ESET EEA ET for ist:20 (1) <0) 1{i)=0; elise r(ij=1: title (unit step function’); UNIT STEP FUNCTION (CONTINUOUS) dle; dose all; clear all, t= -10;0.001:10; for( i= 1-kength() it (<0) y()=0; else y@=1; end; end; plot(ty); xabel(t); ylabel (‘y); title (‘unit step function ‘); “i ew i agnzae3weo: ~OOOKKESGBSSG > “8 ~— UNIT RAMP FUNCTION (DISCREET) cle; Clear all; Close all; t= -10:1:10; for(i=1:21) if(t(i)<0) y(i)=0; else y=); end; end;; stem(ty); xlabel('t’); ylabel(‘y’) title (‘unit ramp function ‘); UNIT RAMP FUNCTION (CONTINUOUS) cle; clear all; close all; = -10:1:10; for(i=1:21) if(t()<0) y@)=0; else, y()=t(i); end; end;; plot(ty); xlabel('t’); ylabel('y’) title (‘unit ramp function ‘); Pa no = ooo = TID Nn HH & ~~ ow Experiment - 3 AIM: To write program using Matlab which plot convolution of two number. THEORY: A discrete time system performs an operation on an input signal based on predefined criteria to produce a modified output signal. The input signal to the system in x(n) and the ouiput of the system is y(n). Y(n) = TEx(n)] =— + T > if the input to the system is a unit impulse then the output of the system is known as impulse response of the system and is denoted by h(n) = Tif(n)] we know that any arbitrary sequence, r(n) can be represented as a weighted sum of discrete impulse given by x(n) =Y2.. x(0)d(n — t) then the output y(n) is equal to TInt x(t)5(n — dO} y(n) = L%. x(t)T5(n — t) = Leox(t)T(n, 2) For a time invariant system y(n) = EA. x(t)T(n — t) as h(n,k) =h(n-k) y(n) = x(n)*h(n) The sum in equation is termed as the convolution sum. * denotes the convolution Operation. Fl il ED: SUBPLOT It divides the current figure into rectangular planes that are numbered row wise. Subsequent plots are output to the current plane. Syntax : Subplot(r,c,p) = number of rows — 9 Oe er ee Ns Tee 8 6- eo -¢ ¢ GS number of columns P —posilion Source Code: cle; clear all; close all; X= [2365986423] y=(24683579] 2 =conv(x.y); subplot(2,2,1) stem (x); xlabel (‘time’) ylabel (‘velocity *) title(‘car a’) subplot(2,2,2) stem (y); xlabel(‘time *) ylabel (‘velocity’) title (‘car b’) subplot(2,2,3) stem (2); xlabel(‘time’) ylabel("velocity’) title (‘car a+b’) CONCLUSION Convolution sum is verified by matrix method w subplot(2.2,2): stem (y); subplot(2,2,3) stem (2); CONCLUSION ‘Auto correlation is verified by mati: x method and Mal tab software- : Experiment - 8 gota piscrete Fi amplin AIM: Piot the spectra of a ideally sampled signal wrt. samP Signal. Theory; . . a discrete In signal processing, sampling is the reduction of a continuous sin Mus signal) signal. A common example is the conversion of a sound wave (a continu to a sequence of samples (a discrete-time signal). es at a point in time and/or space. A sample refers to a value or set of valu xtracts samples from a continuous A sampler is a subsystem or operation that é: signal. The sampling frequency or sampling rate, f,, is the average number of samples obtained in one second (samples per second), thus fs = ar. Reconstructing a continuous function from samples is done by interpolation ically algorithms. The Whittaker-Shannon interpolation formula is mathemati equivalent to an ideallowpass filter whose input is a sequence of Dirac delta functions that are modulated (multiplied) by the sample values. When the time interval between adjacent samples is a constant (7), the sequence of delta functions is called a Dirac comb. Mathematically, the modulated Dirac comb is equivalent to the product of the comb function with s(t). That purely mathematical abstraction is sometimes referred to as impulse sampling Source Code: elec; clear all; close all; A= 2; fm = 3; fs =[ 4, 6, 10} t = 0 20.0121; sig =A *cos(2* pit fm* t); for i= (1:3) ts = 0:1/ fs(i); samsig = At cos (2* pi * fm * £8); gubplot (2,2,i) plot (ts,sig, ‘black’ ) hold on stem (ts, samsig, ‘red') Scanned with CamScanner