State space system gives different bode plot then transfer function matrix
Show older comments
I have a discrete-time system with matrices A,B,C and D
I can either create a [state space system][1], sys1 = ss(A,B,C,D,Ts), of it or compute the [transfer function matrix][2], sys2 = C*inv(z*I- A)*B + D
However when I draw the bode plot of both systems, they are different while they should be the same.
What is going wrong here? Does anyone have a clue? I know btw that the bodeplot generated by sys1 and sys3 is correct.
Note that: my system is already discrete and no discritization is either being done by using
sys1 = ss(A,B,C,D,Ts);
or either
sys2 = C*inv(z*eye(3) - A)*B + D;
or either
[num,den] = ss2tf(A,B,C,D);
sys3 = tf(num,den,Ts);
The script
clear all;
close all;
clc;
Ts = 0.01;
z = tf('z',Ts);
% Discrete system
A = [0 1 0; 0 0 1; 0.41 -1.21 1.8];
B = [0; 0; 0.01];
C = [7 -73 170];
D = 1;
% Set as state space
sys1 = ss(A,B,C,D,Ts);
% Compute transfer function
sys2 = C*inv(z*eye(3) - A)*B + D;
% Compute the actual transfer function
[num,den] = ss2tf(A,B,C,D);
sys3 = tf(num,den,Ts);
% Show bode
bode(sys1,'b',sys2,'r--',sys3,'g--');
[1]: http://en.wikibooks.org/wiki/Control_Systems/MIMO_Systems#State-Space_Representation
[2]: http://en.wikibooks.org/wiki/Control_Systems/MIMO_Systems#Transfer_Function_Matrix
Accepted Answer
More Answers (0)
Categories
Find more on Time and Frequency Domain Analysis in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!