DSP Blockset |
 |
Model Definition
Simulink is a model definition environment. You define a model by creating a block diagram that represents the computations and data flow of your system or application. Try building a simple model that adds two sine waves and displays the result.

- Type
dspstartup
at the MATLAB command line to configure Simulink for DSP simulation (optional).
One of the things that dspstartup
does is set the Stop time value in the
Simulation parameters dialog box to inf
for all new models. The inf
setting instructs Simulink to run the model for as long as the computer's
memory allows. You can access this dialog box and enter a different Stop
time value by selecting Simulation parameters from the model window's
Simulation menu.
- Start Simulink by clicking the
button in the MATLAB toolbar. The Library Browser appears.
- Select New > Model from the File menu in the Library Browser. A new model window appears on your screen.
- Add a Sine Wave block to the model.
- In the Library Browser, click the
symbol next to DSP Blockset to
expand the hierarchical list of DSP libraries.
- In the expanded list, click DSP Sources to view the blocks in the DSP
Sources library.
- Drag the Sine Wave block into the new model window.
- Add a Matrix Sum block to the model.
- Click the
symbol next to Math Functions to expand the Math
Functions library.
- Click the
symbol next to Matrices and Linear Algebra to expand the
Matrices and Linear Algebra sublibrary.
- In the expanded list, click Matrix Operations to view the blocks in the
Matrix Operations library.
- Drag the Matrix Sum block into the model window.
- Add a Scope block to the model.
- Click Sinks (in the Simulink tree) to view the blocks in the Simulink
Sinks library.
- Drag the Scope block from the Sinks library into the model window. (The
Simulink Scope block is the same as the Time Scope block in the DSP
Sinks library.)
- Connect the blocks.
- Position the pointer near the output port of the Sine Wave block. Hold
down the mouse button (the left button for a multibutton mouse) and
drag the line that appears until it touches the input port of the Matrix
Sum block. Release the mouse button.
- Using the same technique, connect the output of the Matrix Sum block to
the input port of the Scope block.
- Set the block parameters.
- Double-click on the Sine Wave block. The dialog box that appears allows
you to set the block's parameters. Parameters are defining values that tell
the block how to operate.
For this example, configure the block to generate a 10 Hz sine wave and a 20 Hz sine wave by entering [10 20]
for the Frequency parameter. Both sinusoids will have the default amplitude of 1
and phase of 0
specified by the Amplitude and Phase offset parameters. They also both share the default sample period of 0.001 seconds specified by the Sample time parameter, which represents a sample rate of 1000 Hz.

Close the dialog box by clicking on the OK button or by pressing Enter on the keyboard.
- Double-click on the Matrix Sum block. Select Rows from the Sum along
parameter, and close the dialog box.
You can now move on to the model simulation phase.
| Getting Started with Simulink | | Model Simulation |  |