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';

2 次查看(过去 30 天)
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 ???

采纳的回答

Walter Roberson
Walter Roberson 2017-3-9
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 个评论
Walter Roberson
Walter Roberson 2017-3-9
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}

请先登录,再进行评论。

更多回答(1 个)

DJIBRINE Abakar
DJIBRINE Abakar 2018-7-16
编辑:Walter Roberson 2018-7-17
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 个评论
Walter Roberson
Walter Roberson 2021-4-19
编辑:Walter Roberson 2021-4-19
you need to pass in a quoted string for the state name, such as 'position' including the '' characters

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Simulink Functions 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by