フィルターのクリア

Designing a moving average filter using DESIGNFILT

6 ビュー (過去 30 日間)
David J. Mack
David J. Mack 2015 年 10 月 20 日
回答済み: Josselin Gautier 2018 年 8 月 16 日
Dear ML-community,
I am trying to implement a moving average filter using the DESIGNFILT method to get an according DIGITALFILTER object. I use the following code:
MAFilterSizeInSamps = 18;
MACutOffFrequencyInHz = 24.601; %Compute from transfer function
Filter = designfilt('lowpassfir',...
'DesignMethod','window',...
'FilterOrder',MAFilterSizeInSamps-1,...
'CutoffFrequency',MACutOffFrequencyInHz,...
'Window','rectwin',...
'SampleRate',1000);
b = ones(1,MAFilterSizeInSamps)/MAFilterSizeInSamps;
a = 1;
[b;Filter.Coefficients]
fvtool(Filter,b,a)
As I understand it, this should yield the same filter coefficients as specified in b (all-0.055556). Instead I get the following coefficients:
Columns 1 through 6
0.045501 0.048867 0.051924 0.05463 0.056946 0.05884
Columns 7 through 12
0.060284 0.061259 0.06175 0.06175 0.061259 0.060284
Columns 13 through 18
0.05884 0.056946 0.05463 0.051924 0.048867 0.045501
So I am stuck here, since I think these should be the same filters! But the filter transfer functions say otherwise!
I am grateful for any clues!
Greetings, David

回答 (1 件)

Josselin Gautier
Josselin Gautier 2018 年 8 月 16 日
Hi, if you are trying to get a digital filter object to use with filtfilt() I would rather recommend to specify directly the numerator and denominator coefficients b and a, and call directly filtfilt() with them. Otherwise, you might be able to export digital filter object with filter designer or filter builder from Signal Processing toolbox

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by