How to simulate a transfer function matrix of closed loop MIMO system?
13 views (last 30 days)
Show older comments
Hamidreza Jafarian
on 7 Apr 2016
Answered: Harish Kumar Anandan
on 27 Mar 2018
Hi,
I have bi MIMO system with 7 inputs and 5 states and 5 outputs. I have simulate the open loop system using 'lsim' which shows the system is unstable. I designed a decentralized controller and now I want to show that my closed loop system is stable by simulating the transfer function matrix. However, now when I simulate the transfer function matrix using 'lsim' all the outputs are NAN. How can I simulate closed loop transfer function of MIMO system using matlab?
Thanks, Hamid
2 Comments
Ced
on 7 Apr 2016
Open loop or closed loop does not matter for lsim. Assuming we are talking about a linear system (since you have a transfer function), all lsim knows is that there is some system with inputs and outputs. Whether that input is the control signal (open loop) or some reference signal (closed loop) is irrelevant.
I'm afraid that if everything is NaN, that points to a problem of your closed loop system rather than the lsim function.
How are you generating your closed loop TF? Have you checked that all the connections are fed back correctly?
Accepted Answer
Ced
on 7 Apr 2016
Edited: Ced
on 7 Apr 2016
Careful!!
sys_orig_tf' not only transposes your system, but takes the complex conjugate of it! This most likely completely changes your system. You probably don't want this. (Happened to me before too ...)
For the actual question, you can name your signals, that way matlab will issue a warning when there are missing connections or so. feedback has an option to use IO names, or alternatively you can use the connect function to specify which are the inputs and output of your systems. Connections with the same name are automatically matched. I think the help has some nice examples, let me know if you have questions.
One more thing:
You can define a feedthrough system (which your controller basically is) in a clean way using ss. E.g. if you have 3 inputs u, and want u1 = 1*pos, u2 = 2*vel, u3 = 5*acc, where pos, vel, acc are the three states/outputs you are feeding back (hypothetically) as compensation, you could
controller = ss([],[],[],diag([ 1 2 5 ]));
controller.InputName = {'pos','vel','acc'};
controller.OutputName = {'u1','u2','u3'};
Note that the output of your plant are the input of the controller ( and vice-versa ).
3 Comments
Ced
on 8 Apr 2016
Edited: Ced
on 8 Apr 2016
Hi
You can transpose it, just not with ', which in matlab is the hermitian operator (i.e. complex conjugate transpose). You need to use either .' (with the dot) or transpose.
Example:
% System with 1 input, 2 outputs
% Each tf is 1/(s^2 + s + 1)
P = tf({1 ; 1},{[1 1 1];[1 1 1]});
% Hermitian system: 2 inputs, 1 output
% Each tf is 1/(s^2 - s + 1), NOTE the minus!
P'
% Transposed system: 2 inputs, 1 output
% Each tf is 1/(s^2 + s + 1)
P.'
transpose(P)
I'm not sure I understand why exactly you need to transpose your system though. Generally, it would be P*C.
Then, for the second issue: You need to specify the I/O names as cells of strings, otherwise Matlab cannot know which ones are supposed to be inputs and which ones outputs, i.e.
cl_u = {'r1','r2','r3','r4'};
cl_y = {'Vg','Vdc1','Vdc2','Vdc3','Id','Iq'};
sys_closed_loop = connect(sys_orig_tf,D1,D2,PI1,PI2,PI3,PI4,PI5,Sum1,Sum2,Sum3,Sum4,Sum5, cl_u, cl_y);
More Answers (1)
Harish Kumar Anandan
on 27 Mar 2018
I have a 2 input 2 output system and I have designed H-infinity controller for the system, Now when I try to get step response how to give feedback command? sO FAR I HAVE WORKED WITH
% step response plant1stp=sbs (g11,g12); plant2stp=sbs (g21,g22); overalplant=abv(plant1stp,plant2stp); loop1=mmult(overalplant,hinf_cont); [l,m,n,o]=unpck(loop1);
disp('step responses') clf step(l1,m1,n1,o1,2)
0 Comments
See Also
Categories
Find more on Dynamic System Models in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!