| Simulink® Control Design™ | ![]() |
x = getxu(op_point)
[x,u] = getxu(op_point)
[x,u,xstruct] = getxu(op_point)
x = getxu(op_point) extracts a vector of state values, x, from the operating point object, op_point. The ordering of states in x is the same as that used by Simulink® software.
[x,u] = getxu(op_point) extracts a vector of state values, x, and a vector of input values, u, from the operating point object, op_point. States in x and inputs in u are ordered in the same way as for Simulink.
[x,u,xstruct] = getxu(op_point) extracts a vector of state values, x, a vector of input values, u, and a structure of state values, xstruct, from the operating point object, op_point. The structure of state values, xstruct, has the same format as that returned from a Simulink simulation. States in x and xstruct and inputs in u are ordered in the same way as for Simulink.
Create an operating point object for the magball model by typing:
op=operpoint('magball');
To view the states within this operating point, type:
op.States
which returns
(1.) magball/Controller/Controller
x: 0
x: 0
(2.) magball/Magnetic Ball Plant/Current
x: 7
(3.) magball/Magnetic Ball Plant/dhdt
x: 0
(4.) magball/Magnetic Ball Plant/height
x: 0.05
To extract a vector of state values, with the states in an ordering that is compatible with Simulink, along with inputs and a state structure, type:
[x,u,xstruct]=getxu(op)
This syntax returns:
x =
0.0500
0
0
7.0036
0
u =
[]
xstruct =
time: 0
signals: [1x4 struct]
View xstruct in more detail by typing:
xstruct.signals
This syntax displays:
1x4 struct array with fields:
values
dimensions
label
blockname
View each component of the structure individually. For example:
xstruct.signals(1).values
ans =
0
0
or
xstruct.signals(2).values
ans =
7.0036
You can import these vectors and structures into Simulink as initial conditions or input vectors or use them with setxu, to set state and input values in another operating point.
![]() | getstatestruct | initopspec | ![]() |
| © 1984-2008- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |