mfilt.firtdecim to dsp.FIRDecimator

11 views (last 30 days)
Alan Jayson
Alan Jayson on 11 Sep 2019
Answered: Alan Jayson on 20 Sep 2019
I’ve used “mfilt.firtdecim” to generator a fir decimation by 2 cic compensation filter (At least 10 years) that import into Filter Designer app.
Want to set CoeffWordLength, InputWordLength, InputFracLength, OutputWordLength, OutputFracLength, AccumFracLength & OverflowMode.
I’m looking to dsp.FIRDecimator to do the same job but it not clear to me how to do that.
If anybody could point me in the right direction, I would appreciate it.
Alan

Answers (3)

Jyothis Gireesh
Jyothis Gireesh on 18 Sep 2019
Please make use of the following code snippet to set the above mentioned properties in dsp.FIRDecimator object.
Hd = dsp.FIRDecimator('Numerator',cfir,...
'CustomCoefficientsDataType',numerictype([],32,24),'CoefficientsDataType','Custom',...
'FullPrecisionOverride',false,...
'CustomOutputDataType',numerictype([],32,0),'OutputDataType','Custom',...
'CustomAccumulatorDataType',numerictype([],32,0),'AccumulatorDataType','Custom',...
'OverflowAction','Saturate');
Since there is no name-value pair to set the customize the numerictype of the input you may have to typecast the input before passing it as input to the "Hd" object. You may make use of the following syntax to achieve the typecasting
inSignalConverted = fi(inSignal,numerictype(1,32,0));
Please go through the following documentation links on dsp.FIRDecimator and casting fixed point objects if you need any clarifications on the same

Alan Jayson
Alan Jayson on 18 Sep 2019
dsp.FIRDecimator object (Hd) can't go into the Filter Designer application (There's an error), only DFILT/MFILT objects work like "mfilt.firtdecim" in the Filter Designer application (Import Filter object).
If MATHWORKS is going to kill "mfilt.firtdecim" I hope they make a converter.
  1 Comment
Jyothis Gireesh
Jyothis Gireesh on 20 Sep 2019
Hi Alan,
I replaced the "mfilt.firtdecim" code with the corresponding code in dsp.FIRDecimator. But I was unable to replicate the error you mentioned above. Could you give further clarification regarding 'dsp.FIRDecimator object (Hd) can't go into the Filter Designer application'?
I am also attaching the edited code for your reference.

Sign in to comment.


Alan Jayson
Alan Jayson on 20 Sep 2019
Hi Jyothis,
Here's a picture of the screen with the error on the code that you attached.
After "filterDesigner(firdecim)" Filter Designer open you must import the object into Filter Designer (That's when you get the error, running the m code doesn't import the object).
Alan

Products


Release

R2019a

Community Treasure Hunt

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

Start Hunting!