필터 지우기
필터 지우기

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

조회 수: 3 (최근 30일)
Hi,
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
Iris

채택된 답변

Walter Roberson
Walter Roberson 2015년 6월 3일
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
Iris
Iris 2015년 6월 4일
편집: Iris 2015년 6월 4일
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.
Thanks!

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Subsystems에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by