ss function and matrix combinations

4 views (last 30 days)
Maria
Maria on 30 Sep 2014
Answered: Drew Davis on 30 Sep 2014
Hi,
I have a question regarding the combination of the results from the ss function. In particular, I am running a code in which the matrices A B C are divided into blocks, like:
A=[A11 A12; A21 A22];
B=[B11 B12; B21 B22];
C=[C11 C12; C21 C22];
I thought that performing
sstot1=[ss(A11,B11,C11,[]) ss(A12,B12,C12,[]);ss(A21,B21,C21,[]) ss(A22,B22,C22,[])];
would be equal to do
sstot2=ss(A,B,C,[]).
But, as I can see from my code, obviously is not equal. Can somebody explain me why sstot1 is different from sstot2 ?

Answers (1)

Drew Davis
Drew Davis on 30 Sep 2014
What are you trying to accomplish by performing these concatenations? In your code for “ssto1”, you are performing concatenations of model objects, specifically state-space models. For “sstot2” you are performing matrix concatenations and then assigning those matrices to a state-space model. This method seems to be the correct one.
MATLAB has no way of understanding that by your concatenation, you want the matrices “A11” (“A12”) and “A21” (“A22”) multiplied by the same states. By the operation you are assigning to the system “ssto1”, MATLAB thinks you are combining multiple systems and adds additional states to the concatenated system by putting the matrices beyond “A11” on the diagonal and modifying the “B” and “C” matrices accordingly.
By pre-concatenating the matrices as performed in “ssto2”, you are explicitly saying which components of the “A” matrix should be multiplied by which states, which components of the “B” matrix should be multiplied by which inputs, and which element of “C” are multiplied by the states.
The following MATLAB documentation page might be of help for combining multiple state space models:

Categories

Find more on Loops and Conditional Statements 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!