Filter Z Transform Manipulation

6 views (last 30 days)
LB
LB on 23 Feb 2021
Edited: Paul on 16 Dec 2024
Hello,
I usually design filters using the filterDesigner and then export its coefficients to the workspace to use in the script. However, now im trying to manipulate the filter I have. What i pretend to is I have a Low Pass filter and i want to observe what happens when I do H(z^2) or something like (0.1(1-z^-1)H(z)). How can i plot this having the original filter coefficients?
Thank you
EDIT: I've tried this:
freqz(test.Numerator.^2,1);
z = tf('z');
H = tf( 0.1 - 0.1*z^(-1), 'Variable','z^-1')
freqz(H*test.Numerator,1)
However i believe its far from correct and the last one simply doesn't work...

Answers (1)

Paul
Paul on 15 Dec 2024
Edited: Paul on 16 Dec 2024
Define a filiter in Signal Processing Toolbox (SPT) and plot the frequency response
fc = 300;
fs = 1000;
[b,a] = butter(6,fc/(fs/2));
figure
freqz(b,a,[],fs)
Convert to Control System Toolbox (CST) and plot the freqency response. Same as above accounting for 360 deg phase shift.
H = tf(b,a,1/fs,'Variable','z^-1');
figure
opts = bodeoptions;
opts.Freqscale = 'linear';
opts.FreqUnits = 'Hz';
opts.XLim = [0,fs/2];
bodeplot(H,opts),grid
Multiply the filter by (0.1 - 0.1*z^-1) in the SPT. Use conv for polynomial multiplication.
bnew = conv(0.1*[1,-1],b);
figure
freqz(bnew,a,[],fs);
Same thing in the CST. Couldn't force the magnitude plot to have the same lower limit as above. Possible bug?
z = tf('z',1/fs);
figure
opts.MagLowerLimMode = 'manual';
opts.MagLowerLim = -120; % doesn't work? %10^(-120/20) also doesn't work?
bodeplot((0.1 - 0.1/z)*H,opts),grid
Implementing H(z^2) is doable, but I think would involve direct manipulation of b and a for the SPT, or the num and den properties of the tf in the CST (or we could detour into the Symbolic Toolbox I suppose).

Products


Release

R2018b

Community Treasure Hunt

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

Start Hunting!