In: Electrical Engineering
4)Design a band-pass filter with a passband from 500 Hz to 2000 Hz using “butter” routine of MATLAB. Assume a sampling frequency of 8KHz. Let the filter order be M=4. Plot the magnitude response and provide the filter coefficients and the transfer function
Fs=8000; % Sampling frequency
M=4; % Filter order
Fl=500; % Lower cutoff frequency
Fh=2000; % Upper cutoff frequency
freq_span=[Fl Fh];
%Bufferworth filter design using
[Z,P,K]= butter(M/2,freq_span/Fs,'bandpass');
[A,B,C,D]= butter(M/2,freq_span/Fs,'bandpass');
[b,a]=butter(M/2,freq_span/Fs,'bandpass');
sos = ss2sos(A,B,C,D);
fvt = fvtool(sos,'Fs',Fs); % Displaying magntitude response
legend(fvt,'butter');
sys=ss(A,B,C,D);
tf(sys) %displaying transfer function
disp('Filter coefficients are: ');
disp(b);
disp(a);
Transfer function =
0.0605 s^4 + 8.06e-17 s^3 - 0.121 s^2 + 7.388e-17 s + 0.0605
------------------------------------------------------------
s^4 - 2.944 s^3 + 3.428 s^2 - 1.904 s + 0.4359
Continuous-time transfer function.
Filter coefficients are:
0.0605 0 -0.1210 0 0.0605
1.0000 -2.9435 3.4276 -1.9038 0.4359