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.
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. Click 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.
Tunable Parameters
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, such as the Sine Wave Frequency parameter, that you can change or tune while a simulation runs. In the online block reference pages, these parameters are marked "Tunable" in the parameter descriptions.
How to Tune Tunable Parameters. To tune a tunable parameter during a simulation, double-click the block to open its Block Parameters dialog, change any tunable parameters to the desired settings, and then click OK or Apply. The simulation continues to run, but with the new parameter settings.
Tunability in Simulation, Accelerator, and External Mode. Block parameters can be tunable in simulation, in the Simulink Performance Tools Accelerator, and in Real-Time Workshop external mode. When a parameter is marked "Tunable" in a reference page, it is tunable only in simulation, unless indicated otherwise.
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 | ![]() |