How to Use Scope in Simulink in MATLAB: Step-by-Step Guide
In Simulink, use the
Scope block to visualize signals during simulation by dragging it into your model and connecting it to signal lines. Run the simulation, and the Scope window will display the signal waveforms in real time.Syntax
The Scope block is used in Simulink models to display signals graphically during simulation. You add it from the Simulink library and connect it to the signal you want to observe.
Key parts:
Scope: The block that shows signal plots.- Signal lines: Connect outputs of blocks to the
Scopeinput. - Simulation: Run the model to see live signal plots.
matlab
open_system('simulink'); % Opens Simulink Library Browser % Drag and drop 'Scope' block into your model % Connect signal line to Scope input % Run simulation to view signals
Example
This example creates a simple Simulink model with a sine wave source connected to a Scope block to visualize the sine wave during simulation.
matlab
model = 'simple_scope_example'; new_system(model); % Create new model open_system(model); % Add Sine Wave block add_block('simulink/Sources/Sine Wave',[model '/Sine Wave']); % Add Scope block add_block('simulink/Sinks/Scope',[model '/Scope']); % Connect Sine Wave output to Scope input add_line(model,'Sine Wave/1','Scope/1'); % Set simulation stop time set_param(model,'StopTime','10'); % Run simulation sim(model); % Open Scope window open_system([model '/Scope']);
Output
Simulating model simple_scope_example.
Simulation finished.
Common Pitfalls
Common mistakes when using Scope in Simulink include:
- Not connecting the signal line to the Scope input, so no data appears.
- Running simulation without opening the Scope window, missing the visualization.
- Using multiple signals without configuring Scope to display multiple inputs.
- Forgetting to set simulation stop time, causing simulation to run indefinitely.
Always verify connections and open the Scope window after simulation.
matlab
model = 'wrong_scope_example'; new_system(model); open_system(model); % Add Sine Wave block add_block('simulink/Sources/Sine Wave',[model '/Sine Wave']); % Add Scope block add_block('simulink/Sinks/Scope',[model '/Scope']); % WRONG: No connection between Sine Wave and Scope % Set simulation stop time set_param(model,'StopTime','5'); % Run simulation sim(model); % Scope window will show no data because no input connected % CORRECT: Connect signal add_line(model,'Sine Wave/1','Scope/1'); open_system([model '/Scope']); sim(model);
Output
Simulating model wrong_scope_example.
Simulation finished.
Simulating model wrong_scope_example.
Simulation finished.
Quick Reference
| Action | Description |
|---|---|
| Add Scope block | Drag from Simulink library 'Sinks' section |
| Connect signal | Link output port of block to Scope input port |
| Run simulation | Click Run or use sim command |
| Open Scope window | Double-click Scope block or use open_system |
| Configure Scope | Use Scope parameters to set number of inputs, axes, and display options |
Key Takeaways
Add the Scope block from Simulink library and connect it to the signal you want to view.
Run the simulation to see live signal plots in the Scope window.
Always open the Scope window to visualize signals during or after simulation.
Ensure signal lines are properly connected to the Scope inputs to avoid empty plots.
Configure Scope settings if you want to display multiple signals or customize the view.