How to find the order of Band pass filter?
5 views (last 30 days)
Show older comments
Hi guys, I am actually constructing a code to seprate a sound signal+noise on the basis of frequencies present in the signal. I have almost completed my code but now I exactly want to calculate the order of my band pass filters which I used in this code since by now I used hit and trial method to find the best suited order. Can anybody tell me how to exactly calculate the order "n" of a band pass? I have used to filters since my signal contain two peaks, one at 1000Hz and other at 2000Hz. My code is as under.
[y,fs]=wavread ('sampledata.wav')
% soundsc(y,fs)
t=0:1/fs:(1-1/fs);
fr_y=fftshift (fft (y)/length(y));
x_axis=2*pi*[-length(t)/2:1: length(t)/2-1];
abs_fr_y = abs(fr_y)
plot(x_axis,abs_fr_y)
y1 = awgn(y,(1-1/fs)); % Add white Gaussian noise.
figure
fr_y1=fftshift (fft (y1)/length(y1));
abs_fr_y1 = abs(fr_y1)
plot(x_axis,abs_fr_y,x_axis,abs_fr_y1)
legend('Original signal','Signal with AWGN');
band_pass_fil1=fir1(1000,[(2*990)/fs,(2*1010)/fs]);
band_pass_fil2=fir1(1000,[(2*1990)/fs,(2*2010)/fs]);
sig_1 = filter(band_pass_fil1,1,y1);
sig_2 = filter(band_pass_fil2,1,y1);
sig_1_f=fftshift(fft(sig_1)/length(sig_1));
signal_1 = abs(sig_1_f)
sig_2_f=fftshift(fft(sig_2)/length(sig_2));
signal_2 = abs(sig_2_f)
figure
plot(x_axis,signal_1);
title('Filtered Signal of "1000Hz"')
figure
plot(x_axis,signal_2);
title('Filtered Signal of "2000Hz"')
0 Comments
Answers (0)
See Also
Categories
Find more on Fourier Analysis and Filtering in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!