Syntax in sysic: Can an array be assigned as an argument in sysic?

I've been getting a problem with the sysic syntax I am changing the number and the combination of outputs when using sysic as below.
for i=1:10
Elements=nchoosek(n,i);
numComb=size(Elements,1);
for j=1:numComb
element=Elements(j,:);
try
Ws=sel(WsAll,element,element);
systemnames = ' P Ws Wt Wn';
inputvar = '[ dist{4}; noise{12}; control{4} ]';
outputvar = '[ Ws; Wt; -P-Wn]'; % Ws=7, Wt=4
input_to_P = '[ control + dist ]';
input_to_Ws = '[ P(element) ) ]';
input_to_Wt = '[ control ]';
input_to_Wn = '[ noise ]';
sysoutname = 'G';
cleanupsysic = 'yes';
sysic;
[K, CL, gamma] = hinfsyn(G,12,4,1,10,0.01,2);
catch ME
fprintf('%s\n',ME.message);
continue
end
combinations(count,:)=element;
gammas(count,:)=gamma;
count=count+1;
end
end
However, matlab does not accept a variable in sysic syntax. The error occurs at
input_to_Ws = '[ P(element) ) ]';
is there any way that I can assign a variable in sysic? Any help would be appriciated

Réponses (1)

Use mat2str to construct the strings that you pass in. For example
input_to_Ws = mat2str(P(element));

2 commentaires

Thank you for your comment, Walter. I just tried your the code and it gives me an error that says,
Check the expression input_to_Ws= '[0 0 0]'. The right-hand side of expression involves a system not listed in SYSTEMNAMES or an input variable not listed in INPUTVAR.
Do you know how to manage it to work?
Okay, I was mistaken before.
Use
P_element = P(element);
input_to_Ws = '[ P_element ) ]';

Connectez-vous pour commenter.

Catégories

En savoir plus sur Sparse Matrices dans Centre d'aide et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by