Simomex. c Implements a single-output, two-input state-space dynamic system described by these state-space dx/dt Ax t bu where x is the state vector, u is vector of inputs and y is the vector of outputs smatrxcat.c Matrix concatenation reshape.c Reshape the input signal stspace.c Implement a set of state-space equations. You can turn this into a new block by using the s-Function block and mask facility. This example MEX-file performs the same function as the built-in State-Space block. This is an example of MEX-file where the number of inputs, outputs and states is dependent on the parameters passed in from the workspace. Use this as a template for other MEX-file systems ctf.c Implement a continuous-time transfer function whose transfer function polynomials are passed in via the input vector. This is useful for continuous time adaptive control applications stvdct f Implement a discrete-time transfer function whose transfer function polynomials are passed via the input vector. This is useful for discrete-time adaptive control applications stvmgain.C Time-varying matrix gain table3.c 3-D lookup table times two.c Basic C MEX S-function that doubles its input
S-Function Examples 1-23 simomex.c Implements a single-output, two-input state-space dynamic system described by these state-space equations dx/dt = Ax + Bu y = Cx + Du where x is the state vector, u is vector of inputs, and y is the vector of outputs. smatrxcat.c Matrix concatenation. sreshape.c Reshape the input signal. stspace.c Implement a set of state-space equations. You can turn this into a new block by using the S-Function block and mask facility. This example MEX-file performs the same function as the built-in State-Space block. This is an example of a MEX-file where the number of inputs, outputs, and states is dependent on the parameters passed in from the workspace. Use this as a template for other MEX-file systems. stvctf.c Implement a continuous-time transfer function whose transfer function polynomials are passed in via the input vector. This is useful for continuous time adaptive control applications. stvdct.f Implement a discrete-time transfer function whose transfer function polynomials are passed in via the input vector. This is useful for discrete-time adaptive control applications. stvmgain.c Time-varying matrix gain. table3.c 3-D lookup table. timestwo.c Basic C MEX S-function that doubles its input. Filename Description
1 Overview of s-functions vdlmint.c Implement a discrete-time vectorized limited Implement the van der pol equation vlimint. c Implement a vectorized limited integrator vsfunc. c lustrate how to create a variable sample time block in Simulink. This block implements a delayed by an amount of time determ nput is variable-step delay in which the fi mined by the second input Fortran S-Function Examples The following table lists sample Fortran S-functions Filename Description sfun-timestwo_for. Sample Level 1 Fortran representation of a C for timestwo S-function stun atmos. c Calculation of the 1976 standard atmosphere to 86km. vdpmexf. for Van der Pol system C++s-Function Examples The following table lists sample C++ S-functions Filename escriptIo stun_counter_cpp. cpp Store a C++ object in the pointers vector PWork. 1-24
1 Overview of S-Functions 1-24 Fortran S-Function Examples The following table lists sample Fortran S-functions. C++ S-Function Examples The following table lists sample C++ S-functions. vdlmint.c Implement a discrete-time vectorized limited integrator. vdpmex.c Implement the Van der Pol equation. vlimint.c Implement a vectorized limited integrator. vsfunc.c Illustrate how to create a variable sample time block in Simulink. This block implements a variable-step delay in which the first input is delayed by an amount of time determined by the second input. Filename Description sfun_timestwo_for. for Sample Level 1 Fortran representation of a C timestwo S-function. sfun_atmos.c Calculation of the 1976 standard atmosphere to 86 km. vdpmexf.for Van der Pol system. Filename Description sfun_counter_cpp.cpp Store a C++ object in the pointers vector PWork. Filename Description
Ada S-Function Examples The simulink/ada/examples directory contains the following examples of S-functions implemented in Ada Directory Name Description matrix gain Implement a Matrix Gain block multi port Multiport block. simple lookup Lookup table Illustrates use of a wrapper S-function that wraps stand-alone Ada code (i.e, Ada packages and procedures ) both for use with Simulink as an S-function and directly with Ada code generated using the rTw ada coder times two Output twice its input 125
S-Function Examples 1-25 Ada S-Function Examples The simulink/ada/examples directory contains the following examples of S-functions implemented in Ada. Directory Name Description matrix_gain Implement a Matrix Gain block. multi_port Multiport block. simple_lookup Lookup table. Illustrates use of a wrapper S-function that wraps stand-alone Ada code (i.e., Ada packages and procedures) both for use with Simulink as an S-function and directly with Ada code generated using the RTW Ada Coder. times_two Output twice its input
1 Overview of s-functions
1 Overview of S-Functions 1-26
Writing Ms-functions The following sections explain how to use the m programming language to create S-functions Introduction(p 2-2) Explains the syntax of an M s-function Defining S-Function Block How to specify the number of states, inputs and outputs, Characteristics(. 2-5) and other attributes of the block implemented by the m S-function Processing S-Function Parameters How to process block parameters passed to the m (p.2-6) S-function Examples of M-File S-Functions Examples of M S-functions that implement various types (p.2-7) of blocks
2 Writing M S-Functions The following sections explain how to use the M programming language to create S-functions. Introduction (p. 2-2) Explains the syntax of an M S-function. Defining S-Function Block Characteristics (p. 2-5) How to specify the number of states, inputs and outputs, and other attributes of the block implemented by the M S-function. Processing S-Function Parameters (p. 2-6) How to process block parameters passed to the M S-function. Examples of M-File S-Functions (p. 2-7) Examples of M S-functions that implement various types of blocks