Conversion from State Space to TF and then back to State Space

3 views (last 30 days)
I created a state space model with 2 inputs 4 outputs 4 states
used the
if true
sys_tf = tf(sys);
end
function to convert SS to tf. sys_tf comes out to a 4 X 2 matrix
Once I obtained this TF I added a PID feedback control to sys_tf(1,2) and sys_tf(3,2). Now when I convert this sys_tf to a state space model using
if true
[A,B,C,D] = ssdata(sys_tf);
sys1 = ss(A,B,C,D);
end
This creates s state space model with 2 inputs, 4 outputs and 30states. Why and how is this happening.
Thanks. Shilp
  2 Comments
Shilp Dixit
Shilp Dixit on 26 Oct 2012
if true
sys_mimo = SS(A, B, C, D, 'statename',states,...
'inputname',inputs,...
'outputname',outputs);
size(sys_mimo)
sys_mimo_tf = tf(sys_mimo);
Kd = 208025;
Kp = 832100;
Ki = 624075;
C = pid(Kp,Ki,Kd);
sys_mimo_tf(1,2) = sys_mimo_tf(1,2)*feedback(sys_mimo_tf(1,2),C);
% PID control for sys_mimo_tf(3,2)
Kd = 208;
Kp = 83;
Ki = 624;
C = pid(Kp,Ki,Kd);
sys_mimo_tf(3,2) = sys_mimo_tf(3,2)*feedback(sys_mimo_tf(3,2),C);
[A,B,C,D] = SSDATA(sys_mimo_tf);
sys_mimo1 = ss(A,B,C,D);
size(sys_mimo1)
end

Sign in to comment.

Accepted Answer

Jonathan Epperl
Jonathan Epperl on 27 Oct 2012
Some points:
Don't do "algebra" with tf variables, use the functions series, parallel and feedback.
sys_mimo1 = ss(sys_mimo) is going to convert the tf model to a ss model, I don't think there is a need for the extra step with ssdata.
This one here
sys_mimo_tf(1,2) = sys_mimo_tf(1,2)*feedback(sys_mimo_tf(1,2),C);
is probably not doing what you want it to, it will give you the transfer function
sys_mimo_tf(1,2)^2 / 1 + sys_mimo_tf(1,2)*C
so that's probably where many extra states come from. You should expect 2 extra states per added PID.
Lastly, look at the Hankel Singular Values or a similar measure to figure out whether there might be a lot of almost unobservable/almost uncontrollable states in your resulting model. That would indicate numerical issues.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!