How to create a band pass filter
3 ビュー (過去 30 日間)
古いコメントを表示
Hi guys,
I would like to pass my .wav file through a band pass filter. I am not sure what order to use. To give an example- my .wav file contains USVs- aka my band is actually from 20 khz to 100 khz (beyond human hearing).
Sampling frequency is 50 kHz
fs = 50e3;
t = linspace(0,1,50e3);
% 1 kHz and 3 kHz sine waves
x = cos(2*pi*1e3*t)+0.5*sin(2*pi*3e3*t)+randn(size(t));
% Lowpass filter everything below 20 kHz
% Specify the filter
hlpf = fdesign.lowpass('Fp,Fst,Ap,Ast',20e3,20.1e3,0.5,50,50e3);
% Design the filter
D = design(hlpf);
% apply the filter
y = filter(D,x);
subplot(211)
plot(t(1:1000),x(1:1000)); title('Original Waveform');
subplot(212)
plot(t(1:1000),y(388:1000+387)); title('Filtered Waveform');
figure;
subplot(211)
plot(psd(spectrum.periodogram,x,'Fs',fs,'NFFT',length(x)));
title('Original Signal PSD');
subplot(212);
plot(psd(spectrum.periodogram,y,'Fs',fs,'NFFT',length(x)));
title('Filtered Signal PSD');
0 件のコメント
採用された回答
Jeremy
2015 年 6 月 18 日
you discuss a bandpass filter but you are applying a lowpass filter...
Aside from that, the order really depends on what type of data you have and what you are trying to accomplish, I know this doesn't really help. But you basically want to minimize the filter order that will meet your requirements. The higher the order, the higher the ripple and phase shift, so start low.
You are using a filter definition that defines the requirements and the filter order will be a result of those requirements. With Fp and Fst so close this will be a very high order filter.
You are also not specifying the design method, equiripple will be the default.
0 件のコメント
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Filter Analysis についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!