How to plot this model in MATLAB script

I have an output error model: y(t)=(0.006559z^-1 - 0.005439z^-2)/(1-1.893z^-1 + 0.8988z^-2) u(t) How would this be plotted using a MATLAB script? I assume it would involve using vectors to represent t and u, but am unsure how the equation would be represented.

Answers (1)

You need to use the Control System Toolbox tf function (supply the correct sampling interval to get the correct plots):
% % H(z) = (0.006559z^-1 - 0.005439z^-2)/(1-1.893z^-1 + 0.8988z^-2)
Ts = -1; % Unknown Sampling Time Interval = ‘-1’
num = [0 0.006559 -0.005439];
den = [1 -1.893 0.8988];
sys = tf(num, den, Ts, 'Variable','z^-1'); % Create System Object
figure(1)
bode(sys)
This plots the Bode plot. You can plot others once you create the system object. You can also convert to other forms, such as state-space. See the documentation on the various functions for details.

Asked:

on 14 Apr 2017

Answered:

on 14 Apr 2017

Community Treasure Hunt

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

Start Hunting!