ss function returning 1x2 ss, can't modify its values.

Hey there,
I downloaded a model program from Matlab (it't in the examples folder) and I tried to modify it to get it working with my own example which we've done at the university. The problem is that in the example the ss(A,B,C,D,Ts) is returning a 1x1 ss az its value, while for my inputs it gives a 1x2 ss. I get the error at the following part:
sysd.C = [eye(2); cholP]; in my case it should be = [eye(3); cholP];
sysd.D = zeros(4, 1); in my case it should be = zeros(6,2);
I get the following error: Error using InputOutputModel/subsasgn (line 57) The values of the "c" and "d" properties must be matrices with the same number of rows.
Truth is I tried every possible combination of sizes and matrix dimensions but it would not work. In the original one after the second row from the above part the 1x1 ss turns into a 4x1 ss. The difference between the two codes (mine and the mathworks one) is the dimensions. They have
Ts = 0.1;
A = [0.8 Ts;0 0.9];
B = [0;Ts];
C = [1 0];
sysd = ss(A,B,C,0,Ts);
while I have
Ts = 0.1;
A = [0.001 -4.4 -6.5;
0.039 0.07 -0.4;
0.003 0.088 0.98];
B = [0.03 1;
0.02 2;
0.01 1];
C = [10 2 -1];
D = [0 0];
sysd = ss(A,B,C,D,Ts);
Fact is that for mine, the ss() stored the first column of my B in the first ss, while the second row of B goes into the second. I have no clue why, whilst for A it can store a whole matrix in one ss.
I attached their original m file, which I would want to work for my inputs.

2 Comments

The code you gave in your question works without error for me (attached below). The explanation is not clear when this error occurs, nor what relation the structure has to the calling of ss.
The error comes in when you try to put data into sys.C, kinda extending it.

Sign in to comment.

Answers (0)

Asked:

on 22 May 2017

Commented:

on 25 May 2017

Community Treasure Hunt

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

Start Hunting!