stun freda. c Frame-based D/A converter stun frmdft c Multichannel frame-based Discrete- Fourier transformation(and its inverse) sfun-multiport.cS-function that has multiple input and output fun matadi. c and one parameter input port, one output port, Matrix add with o stun multirate. c Demonstrate how to specify port-based sample times sfun_psbbreakerc Implement the logic for the breaker block in the Power System Blockset stun psbcontc C Continuous implementation of state-space system stun psbdisccC Discrete implementation of state-space system stun runtime 1.c Run-time parameter example stun runtime2.c Run-time parameter example stun zc. c Demonstrate use of nonsampled zero crossings to implement abs(u). This S-function is designed to be used with a variable-step solver. stun zc sat c Saturation example that uses zero crossings sfunmem. c A one-integration-step delay and hold memory function
1 Overview of S-Functions 1-22 sfun_frmda.c Frame-based D/A converter. sfun_frmdft.c Multichannel frame-based Discrete-Fourier transformation (and its inverse). sfun_frmunbuff.c Frame-based unbuffer block. sfun_multiport.c S-function that has multiple input and output ports. sfun_manswitch.c Manual switch. sfun_matadd.c Matrix add with one input port, one output port, and one parameter. sfun_multirate.c Demonstrate how to specify port-based sample times. sfun_psbbreaker.c Implement the logic for the breaker block in the Power System Blockset. sfun_psbcontc.c Continuous implementation of state-space system. sfun_psbdiscc.c Discrete implementation of state-space system. sfun_runtime1.c Run-time parameter example. sfun_runtime2.c Run-time parameter example. sfun_zc.c Demonstrate use of nonsampled zero crossings to implement abs(u). This S-function is designed to be used with a variable-step solver. sfun_zc_sat.c Saturation example that uses zero crossings. sfunmem.c A one-integration-step delay and hold memory function. Filename Description
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