- 選定濾波器與其規格,以下隨意兩項會決定另一項的數值
- Filter order
- Transition width
- Peak passband/stopband ripple
- 使用fvtool function檢查濾波器圖形
- 檢查Group delay
- shift訊號或是選用zero-phase filter來消除Group delay
FIR vs IIR
- IIR相比FIR有較少的濾波器階數,資源消耗較少
- IIR的group delay是非線性的
範例:
%Bandpass filter with Passband [50 400], Stopband frequency [45 405], Stopband attenuation [60], Passband Ripple [1000].
BPfilt = designfilt('bandpassfir', 'StopbandFrequency1', 45, 'PassbandFrequency1', 50, 'PassbandFrequency2', 400, 'StopbandFrequency2', 405, 'StopbandAttenuation1', 60, 'PassbandRipple', 1, 'StopbandAttenuation2', 60, 'SampleRate', 1000);
fvtool(BPfilt) %檢查濾波器波型
grpdelay(BPfilt) %檢查Group delay
D = mean(grpdelay(BPfilt));% Shift data去補償Group delay的影響
y = filter(BPfilt,[YourData; zeros(D,1)]); % 增加D zeros
y = y(D+1:end);
相關文章:
- https://www.mathworks.com/help/signal/ref/designfilt.html
- https://www.mathworks.com/help/signal/ug/practical-introduction-to-digital-filter-design.html
- https://www.mathworks.com/help/signal/ug/practical-introduction-to-digital-filtering.html
- https://www.mathworks.com/help/signal/ref/filtfilt.html
沒有留言:
張貼留言