Filter function doesn't do filtering

5 ビュー (過去 30 日間)
fineline
fineline 2017 年 8 月 23 日
回答済み: Star Strider 2017 年 8 月 23 日
I have a notch filter designed for 50Hz. Then I generated the filter design code with Filter Design app:
function Hd = filter_notch
Fs=500; Fnotch=50; BW=1; Apass=1;
[b, a] = iirnotch(Fnotch/(Fs/2), BW/(Fs/2), Apass);
Hd = dfilt.df2(b, a);
This is it's frequency response:
Now, I filter input signal with this filter:
filter_block=filter_notch;
out_signal=filter(filter_block,in_signal);
but to my surprise at notch frequency, it amplifies the signal for about 10dB!! Here is the zoomed version. Blue is output, Red is Input. What is going on here?!
%

回答 (1 件)

Star Strider
Star Strider 2017 年 8 月 23 日
I don’t have the DSP System Toolbox, so I cannot run your code.
The power spectral density is probably not the best way to evaluate your filter performance. I would use the fft (link) function instead. I would also use the filtfilt function to do the actual filtering.

カテゴリ

Help Center および File ExchangeDigital Filtering についてさらに検索

タグ

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by