MATLAB SIMULINK 7 - DEVELOPING S-FUNCTIONS User's Guide Page 105

  • Download
  • Add to my manuals
  • Print
  • Page
    / 210
  • Table of contents
  • BOOKMARKS
  • Rated. / 5. Based on customer reviews
Page view 104
Examples of C MEX-File S-Function Blocks
3-61
Example - Discrete State S-Function
The matlabroot/simulink/src/dsfunc.c example shows how to model a
discretesystemin a C MEX S-function.Discretesystems can bemodeled bythe
following set of equations:
dsfunc.c implements a discrete state-space equation. The output portion is
placed in
mdlOutputs and the update portion in mdlUpdate. To visualize how
the simulation works, refer to the flowchart on page 3-16. The output equation
above corresponds to the
mdlOutputs in the major time step. The update
equation above corresponds to the
mdlUpdate in the major time step. If your
model does not contain continuous elements, the integration phase is skipped
and time is moved forward to the next discrete sample hit.
(output)
(update)
yf
0
tx
d
u,,()=
x
d1+
f
u
tx
d
u,,()=
x
d
(states)
uy
(input) (output)
Page view 104
1 2 ... 100 101 102 103 104 105 106 107 108 109 110 ... 209 210

Comments to this Manuals

No comments