Designing a moving average filter using DESIGNFILT

4 Ansichten (letzte 30 Tage)
David J. Mack
David J. Mack am 20 Okt. 2015
Beantwortet: Josselin Gautier am 16 Aug. 2018
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',...
b = ones(1,MAFilterSizeInSamps)/MAFilterSizeInSamps;
a = 1;
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

Antworten (1)

Josselin Gautier
Josselin Gautier am 16 Aug. 2018
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

Community Treasure Hunt

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

Start Hunting!

Translated by