MATLAB SIMULINK 7 - DEVELOPING S-FUNCTIONS Betriebsanweisung Seite 48

  • Herunterladen
  • Zu meinen Handbüchern hinzufügen
  • Drucken
  • Seite
    / 210
  • Inhaltsverzeichnis
  • LESEZEICHEN
  • Bewertet. / 5. Basierend auf Kundenbewertungen
Seitenansicht 47
3 Writing S-Functions As C-MEX files
3-4
Writing Basic C MEX S-Functions
This secti on d iscusses bas ic C MEX S-f unctions, where basic means an
S-function that contains only the required S-function routines. However, the
contents of the routines can be as complex as you like. You have the freedomto
place any logic in S-function routines a s long as the routines conform to their
required formats. This section prese nts a basic C MEX S- function by showing
how to implement an S-function that takes i ts input and multiplies it by two
(see
matlabroot/simulink/src/timestwo.c).
Inthefollowingmodel,the
timestwo S-functionisusedtodouble theamplitude
of a sine wave and plot it in a sco pe:
Within the block dialog fo r the S-function,
timestwo has been s pecified as the
name; the parameters field i s empty.
The
timestwo S-function contains the S-function routines shown in this figure:
Start of simulation
mdlInitializeSizes
mdlInitializeSampleTimes
mdlOutputs
mdlTerminate
Simulatio n
loop
Initialization
Seitenansicht 47
1 2 ... 43 44 45 46 47 48 49 50 51 52 53 ... 209 210

Kommentare zu diesen Handbüchern

Keine Kommentare