DSP Format Discrete Transfer Function Matlab

1 view (last 30 days)
Hi,
If I have a discrete transfer function, defined using sys = filt(num,den)
In Matlab, how to I plot the response of the filter.
Can freqz be used? If so, how do I pass the filt(num,den) to freqz to obtain the bode diagram?
Thank you

Accepted Answer

Paul
Paul on 28 Jan 2022
You can use freqz() if you want, Because filt() returns a tf object from the Control System Toolbox, bode() or bodeplot() functions in that toolbox can also be used
num = [1 2];
den = [1 2 3 4];
sys = filt(num,den);
w = logspace(-2,pi,100);
[m,p] = bode(sys,w);
figure
subplot(211);
semilogx(w,db(squeeze(m)));
subplot(212)
semilogx(w,180/pi*angle(exp(1j*squeeze(p*pi/180))))
h = freqz(sys.num{:},sys.den{:},w);
figure;
subplot(211);
semilogx(w,db(abs(h)));
subplot(212);
semilogx(w,angle(h)*180/pi)

More Answers (0)

Categories

Find more on Dynamic System Models in Help Center and File Exchange

Products


Release

R2021b

Community Treasure Hunt

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

Start Hunting!