Error in sysic: There is a syntax problem with workspace variable OUTPUTVAR.

17 views (last 30 days)
I'm trying to interconnect systems using the sysic function. I find it hard to understand how it works, and I thought I did it right, but I get the error:
There is a syntax problem with workspace variable OUTPUTVAR.
This is what I'd like to achieve:
K is a 1x1 tf and FWT is a 2x3 tf. In my code, FWT is called P. This is what I did:
systemnames = 'K P';
inputvar = '[ref;tau;V]';
outputvar = '[P(1,1)*K+P(1,2)*tau+P(1,3)*V;P(2,1)*K+P(2,2)*tau+P(2,3)*V]';
input_to_K = '[ref-(P(1,1)*K+P(1,2)*tau+P(1,3)*V)]';
input_to_P = '[K;tau;V]';
cleanupsysic = 'yes';
newsys = sysic;
I don't even know if what I'm trying to do would result in the system I want to create, but also I do not understand where the error comes from.
I hope someone can help me out. Thanks in advance

Accepted Answer

Walter Roberson
Walter Roberson on 3 Jun 2015
The documentation for sysic indicates,
outputvar is a char, describing the outputs of the interconnection. Outputs do not have names-they are simply linear combinations of individual subsystem's outputs and external inputs. Semicolons delineate separate components of the interconnections outputs. Between semicolons, signals can be added and subtracted, and multiplied by scalars. For multivariable subsystems, arguments within parentheses specify which subsystem outputs are to be used and in what order. For instance, plant(2:4,1,9:11) specifies outputs 2,3,4,1,9,10,11 from the subsystem plant. If a subsystem is listed in outputvar without arguments, then all outputs from that subsystem are used.
Your P has two outputs, omega and z, so when you use P in outputvar you could reference P or P(1) or P(2) or P(1,2) (both outputs) or P(2,1) (both but in reverse sequence), but when you use P(1,1) you would be implying that you wanted to use the first output of P twice. Do not treat the subsystems as being matrices: treat them as being vectors. A reference to P(a,b,c) in outputvar would have equivalent MATLAB syntax of P([a,b,c]). Your reference to P(2,3) in outputvar would imply that P has 3 outputs, which it does not.
Also, you have
input_to_K = '[ref-(P(1,1)*K+P(1,2)*tau+P(1,3)*V)]';
Here you would be trying to access a third output of P which has only 2 outputs. You are also indicating that tau and V are inputs to K, which is not in evidence on your diagram. You are also indicating that K is input to itself, which is very much not in evidence on your diagram. Your diagram implies only:
input_to_K = '[ref-P(1)]';
That is, the first output of P is subtracted from ref to form the input to K.
  1 Comment
Iris on 4 Jun 2015
Edited: Iris on 4 Jun 2015
Thank you for your answer. I also just figured it out myself but it's good to be sure. I went too fast over the explanation in the documentation and tried to use the example which was more illustrative to me, only it seemed so weird to call P(1) or P(2) because it is a matrix. But knowing it specifies the output channels it makes quite some sense.

Sign in to comment.

More Answers (0)


Find more on Dependency Analysis 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!