Contents

Configure the Simulink Environment for Signal Processing Models

Using dspstartup.m

The DSP System Toolbox™ product provides a file, dspstartup.m, that lets you automatically configure the Simulink® environment for signal processing simulation. We recommend these configuration parameters for models that contain DSP System Toolbox blocks. Because these blocks calculate values directly rather than solving differential equations, you must configure the Simulink solver to behave like a scheduler. The solver, while in scheduler mode, uses a block sample time to determine when the code behind each block executes. For example, if the sample time of a Sine Wave block is 0.05, the solver executes the code behind this block and every other block with this sample time once every 0.05 seconds.

    Note:   When working with models that contain DSP System Toolbox blocks, use source blocks that allow you to specify a sample time. When your source block does not have a Sample time parameter, you must add a Zero-Order Hold block in your model and use it to specify the sample time. For more information, see Continuous-Time Source Blocks. The exception to this rule is the Constant block, which can have a constant sample time. When it does, Simulink executes this block and records the constant value once, which allows for faster simulations and more compact generated code.

To use the dspstartup file to configure Simulink for signal processing simulations, you can

  • Type dspstartup at the MATLAB® command line. All new models have settings customized for signal processing applications. Existing models are not affected.

  • Place a call to dspstartup within the startup.m file. This is an efficient way to use dspstartup if you want these settings to be in effect every time you start Simulink. For more information about performing automated tasks at startup, see the documentation for the startup command in the MATLAB Function Reference.

The dspstartup file executes the following commands:

set_param(0, ...
          'SingleTaskRateTransMsg','error', ...
          'multiTaskRateTransMsg', 'error', ...
          'Solver',                'fixedstepdiscrete', ...
          'SolverMode',            'SingleTasking', ...
          'StartTime',             '0.0', ...
          'StopTime',              'inf', ...
          'FixedStep',             'auto', ...
          'SaveTime',              'off', ...
          'SaveOutput',            'off', ...
          'AlgebraicLoopMsg',      'error', ...
          'SignalLogging',         'off');

You can edit the dspstartup file to change any of these settings or to add your own custom settings. For complete information about these settings, see Model Parameters in the Simulink documentation.

Settings in dspstartup.m

A number of the settings in the dspstartup file are chosen to improve the performance of the simulation:

  • 'Solver' is set to 'fixedstepdiscrete'.

    This selects the fixed-step solver option instead of the Simulink default variable-step solver. This mode enables code generation from the model using the Simulink Coder™ product.

  • 'Stop time' is set to 'Inf'.

    The simulation runs until you manually stop it by selecting Stop from the Simulation menu.

  • 'SaveTime' is set to 'off'.

    Simulink does not save the tout time-step vector to the workspace. The time-step record is not usually needed for analyzing discrete-time simulations, and disabling it saves a considerable amount of memory, especially when the simulation runs for an extended time.

  • 'SaveOutput' is set to 'off'.

    Simulink Outport blocks in the top level of a model do not generate an output (yout) in the workspace.

Was this topic helpful?