How can I give inputs to a MIMO statespace model generated using the command ss(a,b,c,d)?

24 views (last 30 days)
I have obtained the 4 matrices A,B,C and D. I used the inbuilt matlab statespace generator sys_mimo=ss(A,B,C,D) I am trying to get the response of th MIMO statespace model with 2 inputs and 6 outputs. I needed some help regarding 1) How to give a .txt file as an input to the model? 2) How to set a delay between the two inputs? 3) How to obtain the outputs from the statespace model? Any suggesting on this would be helpful.
This is the piece of code under concern % A=[0 1 0 0 0 0 0 0; 0 -(Bf+Br)/ms 0 (lf*Bf-lr*Br)/ms -Kf/ms Bf/ms -Kr/ms Br/ms; 0 0 0 1 0 0 0 0; 0 (lf*Bf-lr*Br)/I 0 -(Bf*lf^2+Br*lr^2)/I lf*Kf/I -lf*Bf/I -lr*Kr/I lr*Br/I; 0 1 0 -lf 0 -1 0 0; -Ktf/muf Bf/muf lf*Ktf/muf -lf*Bf/muf (Kf+Ktf)/muf -Bf/muf 0 0; 0 1 0 lr 0 0 0 -1; -Ktr/mur Br/mur -lr*Ktr/mur lr*Br/mur 0 0 (Kr+Ktr)/mur -Br/mur];
B=[0 0;0 0;0 0;0 0; 0 0; Ktf/muf 0; 0 0;0 Ktr/mur];
C=[1 0 0 0 0 0 0 0; 0 -(Bf+Br)/ms 0 (lf*Bf-lr*Br)/ms -Kf/ms Bf/ms -Kr/ms Br/ms; 0 0 1 0 0 0 0 0; 0 (lf*Bf-lr*Br)/I 0 -(Bf*lf^2+Br*lr^2)/I lf*Kf/I -lf*Bf/I -lr*Kr/I lr*Br/I; 1 0 -lf 0 -1 0 0 0; 1 0 lr 0 0 0 -1 0]; D=[0 0; 0 0 ; 0 0 ; 0 0 ; 0 0 ; 0 0]; sys_mimo= ss(A,B,C,D);
How to proceed from here on?

Answers (1)

Sebastian Castro
Sebastian Castro on 16 Jun 2015
You can use the lsim function to provide arbitrary inputs to a state-space (or transfer function) system and likewise collect the outputs.
As far as reading the inputs into MATLAB from a text file, you could start with the textscan function to see if it does what you want. There are plenty of other related functions that can be used for file I/O.
- Sebastian

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!