Main Content

Configure Simulink Environment for Signal Processing Models

About DSP Simulink Model Templates

DSP Simulink® model templates let you automatically configure Simulink environment with recommended settings for digital signal processing modeling. DSP Simulink model templates let you reuse settings, including configuration parameters. You can create models from templates that use best practices and take advantage of previous solutions to common problems. Instead of the default canvas of a new model, select a template model to help you get started.

For more information on Simulink model templates, see Create Template from Model (Simulink).

Create Model Using DSP System Toolbox Simulink Model Template

To create a new blank model and open the library browser:

  1. On the MATLAB® Home tab, in the File section, click New > Simulink Model. The Simulink Start Page opens with built-in Simulink model templates.

  2. Click one of the templates under DSP System Toolbox to create a model with settings suitable for use with DSP System Toolbox™. A new model using the template settings and contents appears in the Simulink Editor. The model is only in memory until you save it.

  3. To access the library browser, click Library Browser on the model toolstrip.

    The Simulink model templates in the Simulink Start page under DSP System Toolbox. In order, they are Basic Filter, Tunable FIR and IIR Filters, Interpolated FIR Filter, and Mixed-Signal System.

DSP Simulink Model Templates

When you create a model by choosing one of the DSP Simulink model templates, the model is configured to use the settings recommended for DSP System Toolbox. This table shows some of these settings.

Configuration ParameterSetting
SingleTaskRateTransMsgerror
multiTaskRateTransMsgerror
Solverfixedstepdiscrete
EnableMultiTaskingOff
StartTime0.0
StopTimeinf
FixedStepauto
SaveTimeoff
SaveOutputoff
AlgebraicLoopMsgerror
SignalLoggingoff
FrameProcessingCompatibilityMsgerror

These are the Simulink model templates in DSP System Toolbox:

Basic Filter

Click on Basic Filter to create a basic filtering model configured with settings recommended for DSP System Toolbox.

This model implements a lowpass filter and enables you to compare the filtered signal with the original signal. The model acts as a starting point for modeling filtering algorithms in Simulink using DSP System Toolbox.

Diagram of the Basic Filter template. The model has two Sine Wave blocks and a Gaussian Noise block in the input. The outputs of these three blocks are added by an adder. The noisy Sinusoidal signal at the output of the adder is passed into a Lowpass FIR Filter block. The noisy signal and the filtered signal are fed into Spectrum Analyzer as two inputs. The Spectrum Analyzer compares the spectra of these two signals. In the model toolstrip, Stop time is set to Inf and the simulation model is set to 'Normal'.

Here is the Spectrum Analyzer output showing the original signal and the filtered signal. The input signal contains tones at 1 kHz and 15 kHz. The 1 kHz tone gets passed in the filtered output while the 15 kHz tone gets attenuated.

Spectrum Analyzer window showing the input and the filtered output signals.

Tunable FIR and IIR Filters

Design and implement FIR and IIR filters with tunable filter specifications using the Tunable FIR and IIR Filters template.

This model shows how to design FIR and IIR filters using the Tunable Lowpass FIR Filter and the Tunable Lowpass IIR Filter design blocks. You can tune the filter cutoff frequency using the Knob (Simulink) block. The magnitude response of the designed filters varies as you tune the filter cutoff frequency during simulation. Visualize the magnitude response of the designed filters using the Filter Visualizer block. As with the Basic Filter model template, the input is a noisy sinusoidal signal with tones at 1 kHz and 15 kHz.

The Discrete FIR Filter (Simulink) block and the Second-Order Section Filter block implement a lowpass FIR filter and a highpass IIR filter using the coefficients from the design blocks.

Input feeds into Discrete FIR Filter, Second-Order Section Filter, and Spectrum Analyzer blocks. The Tunable Lowpass FIR Filter and the Tunable Highpass IIR Filter blocks feed coefficients into these blocks through their respective coefficient ports. The output signals from the Discrete FIR Filter and Second-Order Section Filter blocks then are fed into the Spectrum Analyzer block.

The Filter Visualizer output shows the varying magnitude response of the FIR filter and the IIR filter, and the Spectrum Analyzer output shows the spectra of the original and the filtered signals. In the Spectrum Analyzer output, both tones get attenuated. The 1 kHz tone gets attenuated by the IIR filter and the 15 kHz tone gets attenuated by the FIR filter.

Interpolated FIR Filter

The Interpolated FIR Filter template provides an efficient alternative to a single-stage high-order FIR filter, as it filters the signal at a lower sampling rate. This implementation processes the input signal in multiple stages. A noisy input first passes through an FIR decimator, which lowers the sampling rate of the signal. The signal is then filtered by two FIR filters at this lower sampling rate. An FIR interpolator at the end converts the sampling rate of the filtered output back to its original value.

Gaussian Noise block generates the noisy input signal followed by an FIR Decimation block, two Discrete FIR filters, an FIR Interpolation block, and a Spectrum Analyzer block.

The Spectrum Analyzer block in the model shows the spectrum of the filtered signal.

Spectrum of filtered signal.

Mixed-Signal System

Click the Mixed-Signal System template to create a basic A/D converter model configured with settings recommended for DSP System Toolbox and mixed-signal systems. This model performs A/D conversion by implementing an analog anti aliasing filter followed by a zero-order hold circuit. The model acts as a starting point for modeling mixed-signal systems in Simulink using DSP System Toolbox. All discrete-time signals are colored in red to indicate the fastest sample rate. Continuous-time signals are colored in black. For additional sample time options, in the Debug tab, select Information Overlays > Colors.

Snapshot of a mixed-signal model template. The Signal Generator block on left generates a continuous-time sinusoidal signal. On one branch of the model, the signal is delayed using a Transport Delay block. On the other branch of the model, the signal is filtered using an Analog Filter Design block. The output of the Analog Filter Design block is continuous-time and is fed into a Zero-Order hold block. The Zero-Order hold block makes the signal a discrete-time signal. The continuous-time signal and the discrete-time counterpart are fed into a scope. The discrete-time signal is also fed into a Spectrum Analyzer. Discrete sample time signals and blocks can be color-annotated to help visual inspection of diagrams. All discrete-time signals are colored, with red identifying the fastest sample rate. Continuous-time signals are black.

The Scope (Simulink) block in the model plots the continuous-time signal and the discrete-time signal.

Scope output showing an overlay of continuous-time signal and discrete-time signal.

The Spectrum Analyzer block shows the spectrum of the discrete-time signal.

Spectrum Analyzer window showing discrete time signal spectrum output

See Also