i have a problem in my program this is code load sys-mbc-22.mat double A ; double B ; double C ; double D ; double Z ; char r ; Z = zeros([30 1]) r = DescStates A = MBC_AvgA B = B2 C = C2 D = D2 %model = 'linopenloopsyss';

i have a problem in my program this is code
load sys-mbc-22.mat
double A ;
double B ;
double C ;
double D ;
double Z ;
char r ;
Z = zeros([30 1])
r = DescStates
A = MBC_AvgA
B = B2
C = C2
D = D2
TMax = 100;
sim('linOpenLoopsyss',[0,TMax]);
when execute it gives
Error using matrices (line 25)
Invalid setting in 'linopenloopsyss/State-Space' for parameter 'X0'.
this image of simulink block parameter
what i can do ???

 Accepted Answer

Change the initial conditions from
'Z'
to
Z
Side note:
In MATLAB, you do not declare the data types of variables. None of the following lines has any useful effect:
double A ;
double B ;
double C ;
double D ;
double Z ;
char r ;
You can just remove them.

5 Comments

it gives me this error
A valid state attribute should be either a character vector, a cell array or a valid MATLAB structure
i am sorry but it gives error
Invalid state name specified for block 'linopenloopsyss/State-Space', a valid state name should be a dot-delimited sequence of Matlab identifiers
note that states is vector (30 x1)
If you mean that DescStates is a 30 x 1 cell array of strings, then you need to pick one of them for the state name, such as
r{1}
finally it works when i change r to 'r' , really thanks for your caring

Sign in to comment.

More Answers (1)

Hi
Sir
please to answer this question
A valid state attribute should be either a character vector, a cell array or a valid MATLAB structure

3 Comments

We need more context for this. Which toolbox are you using? What have you configured for that block?
you need to pass in a quoted string for the state name, such as 'position' including the '' characters

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!