Professional Documents
Culture Documents
Task - 4
Slot : L5+L6
Team :
22BEC0962 - Pugalarasu M
22BEC0389 - Varun M
Code :
clc;
clear all;
close all;
1
% Butterworth Band Stop Filter
Rs=50; % Stop Ripple Factor
Rp=0.01; % Pass Ripple Factor
fp4 = [30 100]; % Pass Band Frequencies
fs4 = [59 61]; % Stop band frequencies
wp4 = fp4 .* 2/fs;
ws4 = fs4 .* 2/fs;
[Nb_4,Wn_4] = buttord(wp4,ws4,Rp,Rs);% Get Order of the filter
[b4,a4] = butter(Nb_4,Wn_4,'stop');% Co-efficients
[h4,f_4] = freqz(b4,a4,N,'whole',fs);% get magnitude
2
subplot(2,1,2);
plot(f,abs(out_butter_fft));
axis([0 14000 0 4000]);
xlabel("Frequency Hz");ylabel("Amplitude");title("Filtered signal using Butterworth
")
3
%chebyshev band stop filter
4
xlabel("Frequency Hz");ylabel("Amplitude");title("Filtered signal using Chebyshev
Filter");
5
Inference
Butterworth :
chebyshev :
• [Nc_5,Wn_5] = cheb1ord(wp5,ws5,Rp,Rs) , using this function we can get the order of the filter and
length of x-axis(chebyshev).
• [b5,a5] = cheby1(Nc_5,Rp,Wn_5,'stop') , using this function we can get the coefficients of the funtion .
6
• [h5,f_5] = freqz(b4,a4,1024,'whole',fs),using this function we can get the magnitude response of filter and
frequency (x-axis) .