Tuesday, July 19, 2011
Programs of IIR Filters
Thursday, July 14, 2011
DSP Lab Programs 4,5,6,7,8,9
4. Matlab program to find frequency response of FIR LPF using Rectangular Window
Program:
n=10;
fp=200;
fr=300;
fs=1000;
fn=2*fp/fs;
window=rectwin(n+1);
b=fir1(n,fn,window);
[h,w]=freqz(b,1,128);
Gain=abs(h);
an=angle(h);
subplot(2,1,1);
plot(w/pi,gain);
title('Normal Magnitude response of LPF');
xlabel('Normalized Frequency');
ylabel('gain in db');
subplot(2,1,2);
plot(w/pi,an);
title('Phase response of LPF');
xlabel('Normalized Frequency');
ylabel('Angle');
5. Matlab Program to find frequency response of FIR Highpass using BLACKMAN window
Program:
n=10;
fp=200;
fr=300;
fs=1000;
fn=2*fp/fs;
window=blackman(n+1);
b=fir1(n,fn,'high',window);
[h,w]=freqz(b,1,128);
Gain=abs(h);
an=angle(h);
subplot(2,1,1);
plot(w/pi,gain);
title('Normal Magnitude response of HPF');
xlabel('Normalized Frequency');
ylabel('gain in db');
subplot(2,1,2);
plot(w/pi,an);
title('Phase response of HPF');
xlabel('Normalized Frequency');
ylabel('Angle');
6. Matlab Program to find frequency Response of FIR LPF using Blackman Window
Program:
n=10;
fp=200;
fr=300;
fs=1000;
fn=2*fp/fs;
window=blackman(n+1);
b=fir1(n,fn,window);
[h,w]=freqz(b,1,128);
Gain=abs(h);
an=angle(h);
subplot(2,1,1);
plot(w/pi,gain);
title('Normal Magnitude response of LPF');
xlabel('Normalized Frequency');
ylabel('gain in db');
subplot(2,1,2);
plot(w/pi,an);
title('Phase response of LPF');
xlabel('Normalized Frequency');
ylabel('Angle');
7. Matlab Program to find frequency response of FIR LPF using Hamming Window
n=10;
fp=200;
fr=300;
fs=1000;
fn=2*fp/fs;
window=hamming(n+1);
b=fir1(n,fn,window);
[h,w]=freqz(b,1,128);
Gain=abs(h);
an=angle(h);
subplot(2,1,1);
plot(w/pi,gain);
title('Normal Magnitude response of LPF');
xlabel('Normalized Frequency');
ylabel('gain in db');
subplot(2,1,2);
plot(w/pi,an);
title('Phase response of LPF');
xlabel('Normalized Frequency');
ylabel('Angle');
8. Matlab Program to find frequency response of FIR LPF using Hanning Window
n=10;
fp=200;
fr=300;
fs=1000;
fn=2*fp/fs;
window=hann(n+1);
b=fir1(n,fn,window);
[h,w]=freqz(b,1,128);
Gain=abs(h);
an=angle(h);
subplot(2,1,1);
plot(w/pi,gain);
title('Normal Magnitude response of LPF');
xlabel('Normalized Frequency');
ylabel('gain in db');
subplot(2,1,2);
plot(w/pi,an);
title('Phase response of LPF');
xlabel('Normalized Frequency');
ylabel('Angle');
9. Matlab Program to find frequency response of FIR LPF using Triangular Window
n=10;
fp=200;
fr=300;
fs=1000;
fn=2*fp/fs;
window=triang(n+1);
b=fir1(n,fn,window);
[h,w]=freqz(b,1,128);
Gain=abs(h);
an=angle(h);
subplot(2,1,1);
plot(w/pi,gain);
title('Normal Magnitude response of LPF');
xlabel('Normalized Frequency');
ylabel('gain in db');
subplot(2,1,2);
plot(w/pi,an);
title('Phase response of LPF');
xlabel('Normalized Frequency');
ylabel('Angle');
Write the Programs in the Observations and get it signed after doing in the lab.
By next week end everyone should complete these programs.
with regards,
B V K
Saturday, July 9, 2011
First Three Matlab Programs of DSP Lab
1.Matlab code to generate sum of sinusoidal signals
Title('sum of sine waves');
t=0:0.5:2*pi;
y=sin(t);
subplot(4,2,1)
stem(y)
xlabel('n');
ylabel('amplitude');
title('sinewave');
subplot(4,2,2);
plot(y);
xlabel('n');
ylabel('amplitude');
title('sinewave');
y1=sin(t)+5*sin(2*t);
subplot(4,2,3);
xlabel('n');
ylabel('amplitude');
title('sinewave with harmonics');
subplot(4,2,4);
stem(y1);
xlabel('n');
ylabel('amplitude');
title('sinewave with harmonics');
y2=sin(t)+5*sin(2*t)+10*sin(3*t);
subplot(4,2,5);
stem(y2);
xlabel('n');
ylabel('amplitude');
title('sinewave with two harmonics');
subplot(4,2,6);
plot(y2);
xlabel('n');
ylabel('amplitude');
title('sine wave with two harmonics');
y3=sin(t)+5*sin(2*t)+10*sin(3*t)+15*sin(4*t);
subplot(4,2,7);
stem(y3);
xlabel('n');
ylabel('amplitude');
title('sinewave with three harmonics');
subplot(4,2,8);
plot(y3);
xlabel('n');
ylabel('amplitude');
2.Matlab Program to verify Linear Convolution
x=input('Enter Input Sequence:');
y=input('Enter Impulse Response:');
y=conv(x,h);
subplot(3,1,1);
stem(x);
ylabel('amplitude');
xlabel('a');
title('input signal');
subplot(3,1,2);
stem(h);
ylabel('amplitude');
xlabel('b');
title('Impulse Response');
subplot(3,1,3);
stem(y);
ylabel('amplitude');
xlabel('c');
title('Linear Convolution');
disp('The Resultant Signal is:');
disp(y)
3.Matlab Program to find N-Point fft of a sequence
x=input('Enter the Sequence:');
n=input('Enter the Length of FFT:');
y=fft(x,n);
subplot(2,1,1);
stem(x);
title('Input Sequence');
xlabel('time index n');
ylabel('Amplitude');
subplot(2,1,2);
stem(y);
title('output sequence');
xlabel('frequency index');
ylabel('amplitude');
with regards,
B V K
Saturday, July 2, 2011
DSP Lab Experiments
Source: JNTUH 4-1 ECE Syllabus Book
Branch: ECE Subject Code: 07A70492 Academic Year: 2011-12 Regulation: R07 Year: IV Semester: I
DIGITAL SIGNAL PROCESSING LAB
TOP
LIST OF EXPERIMENTS :
1. To study the architecture of DSP chips � TMS 320C 5X/6X Instructions.
2. To verify linear convolution.
3. To verify the circular convolution.
4. To design FIR filter (LP/HP) using windowing technique
a) Using rectangular window
b) Using triangular window
c) Using Kaiser window
5. To Implement IIR filter (LP/HP) on DSP Processors
6. N-point FFT algorithm.
7. MATLAB program to generate sum of sinusoidal signals.
8. MATLAB program to find frequency response of analog LP/HP filters.
9. To compute power density spectrum of a sequence.
10. To find the FFT of given 1-D signal and plot.