








































































Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Community
Ask the community for help and clear up your study doubts
Discover the best universities in your country according to Docsity users
Free resources
Download our free guides on studying techniques, anxiety management strategies, and thesis advice from Docsity tutors
Signal processing lab manual, engineering college notes
Typology: Study notes
1 / 80
This page cannot be seen from the preview
Don't miss anything!
COLLEGE OF ENGINEERING AND TECHNOLOGY (Approved by AICTE, New Delhi. Affiliated to Anna University, Chennai) (An ISO 9001: 2015 Certified Institution) ANGUCHETTYPALAYAM, PANRUTI – 607 106
ANNA UNIVERSITY CHENNAI Regulation 2017 EC8562-DIGITAL SIGNAL PROCESSING LABORATORY LIST OF EXPERIMENTS: MATLAB / EQUIVALENT SOFTWARE PACKAGE
INTRODUCTION MATLAB is a software package for high performance numerical computation and visualization provides an interactive environment with hundreds of a built in functions for technical computation, graphics and animation. The MATLAB name stands for Matrix laboratory. At its core, MATLAB is essentially a set (a “toolbox”) of routines (called “m files” or “mex files”) that sit on your computer and a window that allows you to create new variables with names (e.g. voltage and time) and process those variables with any of those routines (e.g. plot voltage against time, find the largest voltage, etc). It also allows you to put a list of your processing requests together in a file and save that combined list with a name so that you can run all of those commands in the same order at some later time. Furthermore, it allows you to run such lists of commands such that you pass in data. and/or get data back out (i.e. the list of commands is like a function in most programming languages). Once you save a function, it becomes part of your toolbox. For those with computer programming backgrounds: Note that MATLAB runs as an interpretive language (like the old BASIC). That is, it does not need to be compiled. It simply reads through each line of the function, executes it, and then goes on to the next line.
%Program for generation of unit ramp signal n1=input('enter the sample length of unit ramp sequence'); t=0:n1; subplot(2,2,3); stem(t,t); ylabel('amplitude'); xlabel('sequence'); title('unit ramp') %Program for generation of discrete exponential signal: n2=input('enter the length of the exponential sequence'); t=0:n2; a=input('enter the a value'); y2=exp(at); subplot(2,2,4); stem(t,y2); ylabel('amplitude'); xlabel('time period'); title('exponential sequence') %Program for generation of continuous exponential signal: n3=input('enter the length of the exponential sequence'); t=0:2:n3-1; a=input('enter the a value'); y3=exp(at); subplot(3,1,1); stem(t,y3); ylabel('amplitude'); xlabel('time period'); title('continuous exponential sequence') %Program for generation of sine wave t=0:0.01: pi; y=sin(2pit); subplot(3,1,2); stem(t,y); ylabel('amplitude'); xlabel('time period'); title('sine wave') %Program for generation of cosine wave t=0:0.01: pi; y=cos(2pit); subplot(3,1,3); stem(t,y); ylabel('amplitude'); xlabel('time period'); title('cosine wave')
Enter the sample length of unit step sequence 8 Enter the length of ramp sequence 6 Enter the length of the exponential sequence 8 Enter the a value 5 -4 -2 0 2 4 0
1 amplitude time period unit impulse 0 2 4 6 8 0
1 amplitude sequence unit step 0 2 4 6 0 2 4 6 amplitude sequence unit ramp 0 2 4 6 8 0 1 2 3 x 10 17 amplitude time period exponential sequence
Ex. No: 2 Date: AIM:
To write MATLAB programs for auto correlation and cross correlation. APPARATUS REQUIRED: HARDWARE : Personal Computer SOFTWARE : MATLAB R2014a PROCEDURE:
PROGRAM: (Cross-Correlation of the Sequences) clc; clear all; close all; x=input('Enter the sequence 1: '); h=input('Enter the sequence 2: '); y=xcorr(x,h); figure; subplot(3,1,1); stem(x); xlabel('n->'); ylabel('Amplitude->'); title('Input sequence 1'); subplot(3,1,2); stem(fliplr(y)); stem(h); xlabel('n->'); ylabel('Amplitude->'); title('Input sequence 2'); subplot(3,1,3); stem(fliplr(y)); xlabel('n->'); ylabel('Amplitude->'); title('Output sequence'); disp('The resultant is'); fliplr(y); OUTPUT: (Cross-Correlation of the Sequences) Enter the sequence 1: [1 3 5 7] Enter the sequence 2: [2 4 6 8]
Ex. No: 3 Date: AIM:
To write MATLAB programs to find out the linear convolution and Circular convolution of two sequences. APPARATUS REQUIRED: HARDWARE : Personal Computer SOFTWARE : MATLAB R2014a PROCEDURE:
%Program for linear convolution %to get the input sequence n1=input('enter the length of input sequence'); n2=input('enter the length of impulse sequence'); x=input('enter the input sequence'); h=input('enter the impulse sequence'); %convolution operation y=conv(x,h); %to plot the signal subplot(3,1,1); stem(x); ylabel('amplitude'); xlabel('n1....>'); title('input sequence') subplot(3,1,2); stem(h); ylabel('amplitude'); xlabel('n2....>'); title('impulse signal') subplot(3,1,3); stem(y); ylabel('amplitude'); xlabel('n3'); disp('the resultant signal is');y
Enter the length of input sequence 4 Enter the length of impulse sequence 4 Enter the input sequence [1 2 3 4] Enter the impulse sequence [4 3 2 1] The resultant signal is y= 4 11 20 30 20 11 4 1 1.5 2 2.5 3 3.5 4 0 2 4 amlitude n1....> input sequence 1 1.5 2 2.5 3 3.5 4 0 2 4 amlitude n2....> impulse signal 1 2 3 4 5 6 7 0 20 40 amlitude n
Enter the input sequence [1 2 2 1] Enter the impulse sequence [4 3 2 1] The resultant signal is y= 15 17 15 13 1 1.5 2 2.5 3 3.5 4 0 1 2 amplitude n1..> input sequence 1 1.5 2 2.5 3 3.5 4 0 2 4 amplitude n impulse sequence 1 1.5 2 2.5 3 3.5 4 0 10 20 amplitude n RESULT: Thus the MATLAB (^) programs for linear convolution and circular convolution written and the results were plotted.
Enter the input sequence [2 1 2 1 2 1 2 1] Enter the number of points in fft 8 The values …. Xk= 12 0 0 0 4 0 0 0 1 2 3 4 5 6 7 8 0 2 4 6 8 10 12 real axis imaginary axis fft
PROGRAM: (Spectrum Analysis Using DFT) N=input('type length of DFT= '); T=input('type sampling period= '); freq=input('type the sinusoidal freq= '); k=0:N-1; f=sin(2pifreq1/Tk); F=fft(f); stem(k,abs(F)); grid on; xlabel('k'); ylabel('X(k)'); INPUT: type length of DFT=32 type sampling period= type the sinusoidal freq= OUTPUT: (Spectrum Analysis Using DFT) RESULT: Thus the Spectrum Analysis of the signal using DFT is obtained using MATLAB.