Professional Documents
Culture Documents
BEEM-F17-005
Lab 11
Lab Task #1: Output:
clc
close all; %Fahad Bin Sajid
clear all; %BEEM-F17-005
bfk=fir1(48,0.6,'low');
freqz(bfk,1,512)
clc
close all; %Fahad Bin Sajid
clear all; %BEEM-F17-005
fsamp=8000;
fcuts=[1000 1500];
mags=[1 0];
devs=[0.05 0.01];
[n,Wn,beta,ftype]=kaiserord(fcuts,mags,devs,fsamp);
hh=fir1(n,Wn,ftype,kaiser(n+1,beta),'noscale');
[H,f]=freqz(hh,1,1024,fsamp);
figure;
plot(f,abs(H));
grid on;
ylabel('Magnitude');
xlabel('Frequencies');
title('Low Pass Filter');
plot(f,abs(H));
ylabel('Magnitude');
xlabel('Frequencies');
title('High Pass Filter');
[n,Wn,beta,ftype]=kaiserord(fcuts,mags,devs,fsamp);
hh=fir1(n,Wn,ftype,kaiser(n+1,beta),'noscale');
[H,f]=freqz(hh,1,1024,fsamp);
figure;
plot(f,abs(H));
ylabel('Magnitude');
xlabel('Frequencies');
title('Band Stop Filter');
fvtool(h);
w3=rectwin(N+1);
a=fir1(N,fcuts/(fsamp/2),'low',w3,flag);
h=dfilt.dffir(a);
fvtool(h);
w4=blackman(N+1);
a=fir1(N,fcuts/(fsamp/2),'low',w4,flag);
h=dfilt.dffir(a);
fvtool(h);
w5=bartlett(N+1);
a=fir1(N,fcuts/(fsamp/2),'low',w5,flag);
fvtool(h);
[H,f] = freqz(h,1,1024,fsamp);
figure;
plot(f,abs(H));
grid on;
ylabel('Magnitude');
xlabel('Frequencies in Hz');
title('Low Pass Filter');