In: Electrical Engineering
Consider the discrete-time filter defined by h = fir1(40,0.2). The coefficients h represent a 40th order filter, with a corner frequency of 0.2 times the Nyquist frequency. Use Matlab help on fir1 to learn more about this command. Plot the frequency response of the filter h using the command freqz. Include this plot in your report.
clc
clear all
close all
N=40; %Order
Fs=0.2; %Nyquist frequency
%fir1(h,wn) creates a window based linear-Phase FIR digital filter
design.
h=fir1(N,Fs);
freqz(h) %frequency response
hold on
subplot(2,1,1)
title('Frequency Response')
subplot(2,1,2)
title('Phase Response')
The response is a Low pass filter response. i.e fir1 by default takes a lowpass filter response.
To perform high pass filter we have to mention high in fir1 function
%---------------High pass filter---------------------
clc
clear all
close all
N=40; %Order
Fs=0.2; %Nyquist frequency
%fir1(h,wn) creates a window based linear-Phase FIR digital filter
design.
h=fir1(N,Fs,'high'); %high pass filter
freqz(h) %frequency response
hold on
subplot(2,1,1)
title('Frequency Response')
subplot(2,1,2)
title('Phase Response')
similarly we can perform remaining filter by including proper parameters in fir1
Please leave feedback