matlab - State space system gives different bode plot then transfer function matrix -
I have a state space system with matrix A, B, C and D.
I have either the However, when I draw the board plot of both systems, they are different, when they are the same. What's going wrong here? Does anyone have a clue? I know that bodeplot generated by The system can be downloaded here: sys2 = c * inv (z * I - A) * B + D
, sys1 = ss (A, B, C, D) code >
sys1
is correct.
clear all; close all; CLC; Ts = 0.01; Z = TF ('Z', TS); % Discrete system A = [0 0 0; 0 0 1; 0.41 -1.21 1.8]; B = [0; 0; 0.01]; C = [7 -73 170]; D = 1; Set as state% sys1 = ss (A, B, C, D, SS); % Compute Transfer function sys2 = C * inv (z * eye (3) - a) * B + D; Calculate% actual transfer function [num, den] = ss2tf (a, b, c, d); Sys3 = tf (num, den, ts); Show% bode bode (sys1, 'b', sys2, 'r -', sys3, 'g--'); Edit: I made a small mistake, the transfer function matrix
sys2 = C * inv (z * I - A) * B + D
, Instead of sys2 = C * inv (z * I - A) * b - d
, which I did before. The problem still holds. Edit 2: I have indicated that when I calculate all the way, it is correct.
sys z; Collected ((z * eye (3) - a), z)
its notion Is that sys2 = C * inv (z * I-A) * B + D
is incorrect. Your state-space system (A, B, C, D) is equal to sys2 = C * inv (S * I-A) * B + D
. If you want to express it in the context of z
, then you have to reverse the relationship z = exp (s * T)
. sys1
is the correct representation of your state-space system What do I suggest for sys2
:
sys1 = ss (mjlsCE.A , MjlsCE.B, mjlsCE.C, mjlsCE.D, ts); Sys1_c = d2c (sys1); S = TF ('s'); Sys2_c = sys1_c.C * inv (s * eye (length (sys1_c.A)) - sys1_c.A) * sys1_c.b + sys1_c.D; Sys2_d = c2d (sys2_c, ts);
You should give the right result.
Comments
Post a Comment