This question is closed. Reopen it to edit or answer.
multistage filter with simulink model
1 view (last 30 days)
I have a multistage filter, that consists of sinc3, two FIRs and one IIR, which I need to get frequency response of. I'm using cascade and freqz commands, however the last stage is represented by a IIR simulink filter, which I cannot use directly in the Matlab workspace.
How can I use this Simulink model into the freqz or fvtool command? I've tried to get transmfer function of it, and insert in the filter object num and dnum, but had not consistent result. Somethink like the reverse 'realizemdl' whould work.
Elady on 1 Jul 2021
Edited: Elady on 1 Jul 2021
Since you mentioned that you use a filter cascade, I assume that you are using the DSP Systems Toolbox.
Using MATLAB IIR filter objects (or system objects, see note below) is the way to go here. Given that you have the transfer function, you can use the dfilt IIR filter objects (offered in all cannonical forms, i.e. dfilt.df1, dfilt.df2, dfilt.df1t, or dfilt.df2t). Those can be used with a filter object cascade. Regarding inconsistent results, it's hard to tell without more details.
I am not aware of a tool that takes a Simulink model consisting of a graph of blocks and parses it automatically as an IIR filter (this almost falls into the category of system identification). However, since your model is relatively simple, determining the numerator and denominator should not be too difficult to do by hand.
Last note: I would recommend using System objects instead of filter objects, which are gradually being phased out. That is, use dsp.FIRFilter, dsp.IIRFilter, and dsp.FilterCascade system object. You can use the fvtool() with System objects as well.