User`s guide

2 Writing S-Functions As M-Files
2-8
Examples of M-File S-Functions
The simple example discussed above (timestwo) has no states. Most
S-Function blocks require the handling of states, whether continuous or
discrete.Thesectionsthatfollowdiscussfourcommontypesof systemsyoucan
model in Simulink using S-functions:
Continuous
Discrete
Hybrid
Variable-step
All examples are based on the M-file S-function template found in
sfuntmpl.m.