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
This comment has been removed by the author.
ReplyDeleteWhere ever all should be Gain or gain
ReplyDeleteHere in Matlab
ReplyDelete'A' is different from 'a'
so 'Gain' and 'gain' are diff..!
This comment has been removed by the author.
ReplyDeleteif u r writing Gain then write everywhere as Gain or if you are writing gain then write gain everywhere man. Matlab is case sensitive, so represent everything in one format only. The problem arised because i have written code in MS Word. so, every new line is going to start with a capital letter. I have changed many but few are left like that. However you spotted the error okay good.
ReplyDeletewith regards,
B V K.