DSP Blockset | ![]() ![]() |
Model Simulation
Simulink is also a model simulation environment. You can run the simulation block diagram that you have built to see how the system behaves. To do this:
[1x2]
" appears on the output line from Sine Wave indicating that the output is a 1-by-2 matrix.
At each sample time, the output matrix contains one sample from each of the two sinusoids. The Matrix Sum block adds the two matrix elements together to produce a scalar output. Thus, the input to the Scope block is the point-by-point sum of the two sinusoids.
0.1
for Time
range. This resizes the scope's time axis to display only one cycle of the
signal.
[1 5]
or
[100 400]
in the Frequency field. Press Apply after entering each new
value, and observe the changes on the scope.
Note that the sample rate of both sinusoids is 1000 Hz, so aliasing will occur for sinusoid frequencies above 500 Hz. You can increase the sample rate by entering a smaller value in the Sine Wave block's Sample time parameter. This parameter is not tunable (see below), so you will need to stop the simulation before making any adjustment.
Many parameters cannot be changed while a simulation is running. This is usually the case for parameters that directly or indirectly alter a signal's dimensions or sample rate. There are some parameters, however, like the Sine Wave Frequency parameter, that you can tune without terminating the simulation. In the online DSP Block Reference these parameters are marked "Tunable," indicating that they are tunable while the simulation runs.
Running a Simulation from an M-File. You can also modify and run a Simulink simulation from within a MATLAB M-file. By doing this, you can automate the variation of model parameters to explore a large number of simulation conditions rapidly and efficiently. For information on how to do this, see Delay and Latency and "Running a Simulation from the Command Line" in the Simulink documentation.
![]() | Model Definition | Learning More About Simulink | ![]() |