mfilt.firtdecim to dsp.FIRDecimator

2 次查看(过去 30 天)
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

回答(3 个)

Jyothis Gireesh
Jyothis Gireesh 2019-9-18
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 2019-9-18
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 个评论
Jyothis Gireesh
Jyothis Gireesh 2019-9-20
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.

请先登录,再进行评论。


Alan Jayson
Alan Jayson 2019-9-20
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

类别

Help CenterFile Exchange 中查找有关 Digital Filter Design 的更多信息

产品


版本

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by