Professional Documents
Culture Documents
Each student must have their own laboratory notebook. All pre-lab exercises and laboratory reports are to be entered into your notebook. Your notebook must be clearly labelled on the cover with the following information:
Introduction
There are 2 hours allocated to a laboratory session in Digital Signal Processing. It is a necessary part of the course at which attendance is compulsory. Here are some guidelines to help you perform the experiments and to submit the reports: 1. Read all instructions carefully and carry them all out. 2. Ask a demonstrator if you are unsure of anything. 3. Record actual results (comment on them if they are unexpected!) 4. Write up full and suitable conclusions for each experiment. 5. If you have any doubt about the safety of any procedure, contact the demonstrator beforehand. 6. THINK about what you are doing!
LIST OF EXPERIMENTS
1. 2. 3.
To write a program to represent basic signal (unit step, unit impulse, ramp, exponential, Sine sequence, Cosine sequence). To perform the discrete convolution of sequences. To write a program for discrete correlation. (a)Program for computing cross correlation of the sequences (b) Program for computing auto correlation.
4.
To design (a) Program for low pass IIR butterworth filter (b) Program for high pass IIR butterworth filter
5.
To Design a digital filter using rectangular window method. (a) Program for low pass filter (b) Program for high pass filter (c) Program for band pass filter (d) Program for band stop filter
6.
To design (a) Program for low pass filter (b) Program for high pass filter (c) Program for band pass filter
APPARATUS REQUIRED:
MATLAB SOFTWARE, PC
Program: clc; clearall; close all; n=input('enter the N value'); t=0:1:n-1; y1=ones(1,n);subplot(2,2,1); stem(t,y1); ylabel('Amplitude -->'); xlabel('(a) n -->'); title('unit step signal'); t=-2:1:2; y=[zeros(1,2),ones(1,1),zeros(1,2)]; subplot(2,2,2); stem(t,y); ylabel('Amplitude -->'); xlabel('(b)n -->'); title('unit impulse signal'); n1=input('eneter the length of ramp sequence'); t=0:n1; subplot(2,2,3); stem(t,t); ylabel('Amplitude -->');
xlabel('(c)n -->'); title('Unit ramp sequence'); n2=input('enter the length exponential sequence'); t=0:n2; a=input('enter the value of a'); y2=exp(a*t); subplot(2,2,4); stem(t,y2); ylabel('Amplitude -->'); xlabel('(d)n -->'); title('exponential sequence');
Output:enter the N value7 eneter the length of ramp sequence7 enter the length exponential sequence7 enter the value of a1
Program to represent basic signal (unit step, unit impulse, ramp, exponential, Sine sequence, Cosine sequence).
Program:n=0:.01:pi; y=sin(2*pi*n); subplot(2,2,1); stem(n,y); xlabel('(a)n'); ylabel('Amplitude -->'); title('Sine Sequence'); n=0:.01:pi; y1=cos(2*pi*n); subplot(2,2,2); stem(n,y1); xlabel('(b)n'); ylabel('Amplitude -->'); title('cosine sequence');
EXPERIMENT NO. 2
AIM:
APPARATUS REQUIRED:-
Output:enter the first sequence [1 2] enter the second sequence [1 2 4] The resultant signal is y=1488
EXPERIMENT NO. 3
AIM:
APPARATUS REQUIRED:
Output:enter the first sequence[1 2 3 4] enter the second sequence[4 3 2 1] The resultant signal is y= Columns 1 through 3 1.0000 4.0000 10.0000 Columns 4 through 6 20.0000 25.0000 24.0000 Column 7 16.0000
Output:enter the sequence[1 2 3 4] The resultant signal is y= Columns 1 through 3 4.0000 11.0000 20.0000 Columns 4 through 6 30.0000 20.0000 11.0000 Column 7 4.0000
subplot(2,1,1); plot(om/pi,20*log10(m));grid ylabel('gain in db '); xlabel('(a) normalised frequency '); subplot(2,1,2); plot(om/pi,an);grid ylabel('phase in radian'); xlabel('(b) normalised frequency ');
OUTPUT: enter the stop band ripple 30 enter the pass band ripple 0.40 enter the stop band frequency 800 enter the pass band freequency 400 enter the sampling frequency 2000 b =0.1518 a = 1.0000 0.6073 0.6418 0.9109 0.6165 0.6073 0.1449 0.1518 0.025
OUTPUT:enter the stop band ripple 30 enter the pass band ripple .4 enter the stop band frequency 800 enter the pass band freequency 400 enter the sampling frequency 2000 b =0.0535 -0.2139 a =1.0000 0.6418 0.3209 -0.2139 0.6165 0.1449 0.0535 0.0259
EXPERIMENT NO. 5
AIM: To Design a digital filter using rectangular window method. APPARATUS REQUIRED:
MATLAB SOFTWARE, PC
subplot(2,1,2); plot(w/pi,an);grid xlabel('normalized frequency'); ylabel('phase shift'); title('phase response of low pass filter using rectangular window');
EXPERIMENT NO. 6 AIM: To design the program for analog butterworth filter.
APPARATUS REQUIRED:
(A) Program for low pass filter
clc; clear all; close all; rs=input('enter the stopband ripple='); rp=input('enter the passband ripple='); ws=input('enter the stopband frequency='); wp=input('enter the passband frequency='); fs=input('enter the sampling frequency='); w1=2*wp/fs; w2=2*ws/fs; %find the order and cut off frequency [n,wn]=buttord(w1,w2,rs,rp,'s'); %calculating system function [b,a]=butter(n,wn,'s'); %plot frequency response w=0:0.01:pi; [h,w]=freqs(b,a,w); m=20*log10(abs(h)); subplot(2,1,1); plot(w/pi,m);grid MATLAB SOFTWARE, PC
ylabel('Gain in dB--'); xlabel('Normalised Frequency--'); title('Magnitude Response of low pass filter'); an=angle(h); subplot(2,1,2); plot(w/pi,an); grid ylabel('Phase in radians--'); xlabel('Normalised Frequency--'); title('Phase Response of low pass filter');
OUTPUT:enter the stopband ripple=.25 enter the passband ripple=60 enter the stopband frequency=3000 enter the passband frequency=2000 enter the sampling frequency=9000 n =21 wn =0.4798
OUTPUT:enter the stopband ripple=.25 enter the passband ripple=60 enter the stopband frequency=3000 enter the passband frequency=2000 enter the sampling frequency=9000 n = 21 wn =0.4798
OUTPUT:enter the stopband ripple=50 enter the passband ripple=60 enter the stopband frequency=70 enter the passband frequency=80 enter the sampling frequency=90 n=9 wn = 1.7778 1.5556
OUTPUT:enter the stopband ripple=50 enter the passband ripple=60 enter the stopband frequency=70 enter the passband frequency=80 enter the sampling frequency=90 n=9 wn = 1.7778 1.5556