In /usr/share/local/matlab42/toolbox/simulink
- /include
- /src
- simstruc.h
- Data structures and access methods for S-function C files.
This file contains details of SimStruct which is used to
store attributes of the simulation such as pointers to storge
vectors.
Copyright (c) 1993 The Mathworks, Inc.
All Rights Reserved
- simulink.c
- SIMULINK.C - Include file for compiling MEX-file systems and blocks
This file should be included at the end of a MEX-file system. It
provides an interface to the MEX-file mechanism that allows blocks
and systems to be entered only as their corresponding mathematical
functions without the need for addition interface code
Syntax of MEX-file S-function:
[sys, x0] = filename(t, x, u, flag)
Andrew Grace Dec 1st, 1992
Revised ACWG 1-10-91
Revised RAS 12-17-92
Copyright (c) 1993 The Mathworks, Inc.
All Rights Reserved
- Readme
- This directory contains examples of SIMULINK blocks and models
written in C and Fortran. They are implemented as MEX-file
S-functions.
Example C and Fortran models.
simomex.c - simo model, C form.
simomexf.f - simo model, Fortran form.
vdpmex.c - Van der Pol model, C form.
vdpmexf.f - Van der Pol model, Fortran form.
mixedmex.c - Mixed continuous/discrete model, C form.
Example C and Fortran blocks.
limintc.c - Limited integrator block.
dlimintc.c - Discrete-time limited integrator block.
vlimintc.c - Vectorized limited integrator.
vdlmintc.c - Discrete-time vectorized limited integrator.
resetint.c - Reset integrator.
stspace.c - State-space block.
sfunmem.c - One integration-step delay and hold.
usersys.f - Generic model/block, Fortran form.
See also the "blocks" directory on MATLAB's search path.
This area contains M-file versions of the above examples.
See the SIMULINK 1.3 release notes for documentation on
S-functions and developing C and Fortran blocks and models.
- bf2f
- Name:
bf2f script to create .f files from .F files
Usage:
bf2f [-h|-help] | file.F . . .
Description:
This Bourne Shell script takes .F files with 'pointer' statements
and creates new .f files with the 'pointer' statements replaced by
the Fortran type statements appropriate for the platforms and
removing any C preprocessing statements that start with .
Options:
h - help. Print usage.
Example:
The following command will create yprime.f and yprimeg.f with
the pointer statements replaced.
bf2f yprime.F yprimeg.F
Copyright (c) 1994 by The MathWorks, Inc.
Revision: 1.4 Date: 1994/04/01 13:33:21
- dlimintc.c
- DLIMINTC Example MEX-file for a discrete-time limited integrator.
(see manual under Advanced Topics).
Syntax: [sys, x0] = dlimintc(t,x,u,flag,lb,ub,x0,ts)
Andrew Grace Jan 10, 1991
Copyright (c) 1991-94 by The MathWorks, Inc.
All Rights Reserved
- limintc.c
- LIMINTC Example MEX-file for a limited integrator.
(see manual under Advanced Topics).
Syntax: [sys, x0] = limintc(t,x,u,flag,lb,ub,x0)
Andrew Grace Jan 10, 1991
Copyright (c) 1990-94 by The MathWorks, Inc.
All Rights Reserved
- logsigc.c
- LOGSIGC Implements logsig transfer functions for implemention of
neural networks within SIMULINK.
Logistic Sigmoid Activation Transfer Function.
Returns elements of N squashed between 0 and 1
using the log-sigmoid function.
See also: LOGSIG, RADBAS, RADBASC, TANSIG, TANSIGC.
Syntax: [sys, x0] = logsigc(t,x,u,flag)
Andy Grace Nov-29th 1993
Copyright (c) 1990-94 by The MathWorks, Inc.
All Rights Reserved
- mixedmex.c
- MIXEDMEX Example MEX-file for a single-input, single-output system
with mixed continuous and discrete states.
(see manual under Advanced Topics).
Use this as a template for other MEX-file systems
that contain discrete and/or continuous states.
Syntax: [sys, x0] = mixedmex(t,x,u,flag)
Andrew Grace Oct 11, 1990
Copyright (c) 1990-94 The Mathworks, Inc.
All Rights Reserved
- quantize.c
- MIXEDMEX Example MEX-file for a single-input, single-output system
with mixed continuous and discrete states.
(see manual under Advanced Topics).
Use this as a template for other MEX-file systems
that contain discrete and/or continuous states.
Syntax: [sys, x0] = mixedmex(t,x,u,flag)
Andrew Grace Oct 11, 1990
Copyright (c) 1990-94 The Mathworks, Inc.
All Rights Reserved
- radbasc.c
- RADBASC Implements radbas transfer functions for implemention of
neural networks within SIMULINK.
Radial basis Activation Transfer Function.
Returns elements of N squashed between 0 and 1
using the function y=exp(-(b n)^2).
See also: RADBAS, TANSIG, TANSIGC, LOGSIG, LOGSIGC.
Syntax: [sys, x0] = radbasc(t,x,u,flag)
Andy Grace Nov-29th 1993, AFP 12-8-93
Copyright (c) 1990-94 by The Mathworks, Inc.
All Rights Reserved
- resetint.c
- RESETINT A reset integrator.
(see manual under Advanced Topics).
Syntax: [sys, x0] = resetint(t,x,u,flag,x0)
Rick Spada 11-12-93
Copyright (c) 1994 The MathWorks, Inc.
All Rights Reserved
- sftable2.c
- SFTABLE2 A two dimensional table lookup in S-Function form.
(see manual under Advanced Topics).
Syntax: [sys, x0] = sftable2(t,x,u,flag)
This file is designed to be used in a SIMULINK S-Function block.
It performs a 2-D lookup on the table passed in through the
parameter list. It makes use of the variables XINDEX, YINDEX,
TABLE, XO, and YO, where the first three of these are passed in
through the parameter list, and the last two, XO and YO, are
passed in as the inputs, respectively u(1) and u(2).
The section of code in the mdlOutputs function returns a linearly
interpolated intersection from the array TABLE, looking up X0
first with the vector XINDEX, then looking up Y0 with the vector
YINDEX. The matrix TABLE has entries that correspond to the
X and Y indices and therefore must have the same number of rows as the
vector XINDEX and the same number of columns as the vector
YINDEX. TABLE contains the output values to be interpolated among.
Both XINDEX and YINDEX must increase monotonically.
Extrapolation is used for values outside the limits of XINDEX
and YINDEX based on the four closest points.
Ned Gulley 12-19-91
Copyright (c) 1991-94 by the MathWorks, Inc.
All Rights Reserved
- sfunmem.c
- SFUNMEM A one integration-step delay and hold "memory" function.
(see manual under Advanced Topics).
Syntax: [sys, x0] = sfunmem(t,x,u,flag)
This file designed to be used in a SIMULINK S-Function block.
It performs a one integration-step delay and hold "memory" function.
Thus, no matter how large or small the last time increment was in
the integration process, this function will hold the input variable
from the last integration step.
Use this function with a clock as input to get the step-size at each
step of a simulation.
Andrew Grace & Ned Gulley April 3, 1992
Copyright (c) 1993-94 The MathWorks, Inc.
All Rights Reserved
- sfuntmpl.c
- SFUNTMPL Template C S-function source file.
Copyright (c) 1994 by The MathWorks, Inc.
All Rights Reserved
- simomex.c
- SIMOMEX Example mex file for single-input, two output state-space system.
(see manual under Advanced Topics).
Use this file as a template for other continuous
system C-code S-Functions.
Syntax [sys, x0] = simomex(t,x,u,flag)
Andrew Grace Oct 11, 1990
Copyright (c) 1990-94 The MathWorks, Inc.
All Rights Reserved
- simomexf.F/simomex.f
- SIMOMEX.F
This is a FORTRAN representation of the SIMO system.
It works in conjunction with the the file SIMULINK.F.
To compile this system, use the syntax: fmex simomex.f simulink.f
- simstruc.c
- simstruc.c - creation and deletion of model data structure
File that contains all the C code for creating, destroying
and initializing the simulation structure. The simulation
structure is defined in simstruc.h. This file also uses many
of the access methods defined in simstruc.c.
Copyright (c) 1993 The MathWorks, Inc.
All Rights Reserved
- simulink.F/simulink.f
- Purpose:
Glue routine for making FORTRAN MEX-file systems and blocks
Synopsis: [sys,x0] = usersys(t,x,u,flag)
Description:
This file should be linked with the subroutines that return
derivatives, outputs, discrete states and sample times.
Use a syntax of the form: fmex usersys.f simulink.f
where usersys.f is the name of the user-defined function.
Algorithm: Usersys is a MEX-file
Written: Aleksandar Bozin Mar 03, 1992
Modifications, bug fixes and extensions:
Ned Gulley Apr 29, 1992
Copyright (c) 1990-93 by The MathWorks, Inc.
All Rights Reserved
- stspace.c
- STSPACE Example mex file S-function for state-space system.
Implements 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.
Syntax [sys, x0] = stspace(t,x,u,flag,A,B,C,D,X0)
Andrew Grace Oct 11, 1990
Copyright (c) 1990-94 The MathWorks, Inc.
All Rights Reserved
- tansigc.c
TANSIGC Implements tansig transfer functions for implemention of
neural networks within SIMULINK.
Hyperbolic Tangent Sigmoid Activation Transfer Function.
Returns elements of N squashed between -1 and 1
using the tan-sigmoid function.
See also: TANSIG, LOGSIG, LOGSIGC, RADBAS, RADBASC.
Syntax: [sys, x0] = tansigc(t,x,u,flag)
Andy Grace Nov-29th 1993
Copyright (c) 1990-94 by The MathWorks, Inc.
All Rights Reserved
- usersys.F/usersys.f
- Purpose: Function to set size vector
Input arguments: None
Output arguments: SIZE a vector of model sizes
Description: Sizes returns a vector which determines model characteristics.
This vector contains the sizes of the state vector and other
parameters. More precisely,
SIZE(1) number of continuous states
SIZE(2) number of discrete states
SIZE(3) number of outputs
SIZE(4) number of inputs
SIZE(5) number of discontinuous roots in the system
SIZE(6) set to 1 if the system has direct feedthrough of its
inputs, otherwise 0
Copyright (c) 1990-93 by the MathWorks, Inc.
- vdlmintc.c
- VDLMINTC Example MEX-file for a discrete-time vectorized limited integrator.
(see manual under Advanced Topics).
Syntax: [sys, x0] = vdlmintc(t,x,u,flag,lb,ub,xi,ts)
Rick Spada 9-3-93
Copyright (c) 1993-94 by The MathWorks, Inc.
All Rights Reserved
- vdpmex.c
- VDPMEX Example MEX-file system for Van der Pol equations
(see manual under Advanced Topics).
Use this as a template for other MEX-file systems
which are only composed of differential equations.
Syntax [sys, x0] = vdpmex(t, x, u, flag)
Andrew Grace Oct 11, 1990
Erick Asplund Nov 23, 1993
Copyright (c) 1990-94 The MathWorks, Inc.
All Rights Reserved
- vdpmexf.F/vdpmexf.f
- VDPMEX.F
This is a FORTRAN representation of the Van der Pol system.
It works in conjunction with the the file SIMULINK.F.
To compile this system, use the syntax: fmex vdpmex.f simulink.f
Written: Ned Gulley Apr 28, 1992
Copyright (c) 1990-93 by The MathWorks, Inc.
All Rights Reserved
- vlimintc.c
- VLIMINTC Example mex-file for a vectorized limited integrator.
(see manual under Advanced Topics).
Syntax: [sys, x0] = limintc(t,x,u,flag,lb,ub,x0)
Rick Spada 9-3-93
Copyright (c) 1993-94 by The MathWorks, Inc.
All Rights Reserved
Compiled by Jerod M. Parker(jparker@bass.gmu.edu)
June 1994