simulink - introduction with practical example
TRANSCRIPT
![Page 1: Simulink - Introduction with Practical Example](https://reader036.vdocument.in/reader036/viewer/2022062412/58ed8bc91a28abf60d8b4653/html5/thumbnails/1.jpg)
Presentationon
SIMULINK
By: Kamran Gillani
![Page 2: Simulink - Introduction with Practical Example](https://reader036.vdocument.in/reader036/viewer/2022062412/58ed8bc91a28abf60d8b4653/html5/thumbnails/2.jpg)
Contents:• Introduction• Model Overview• Define Parameters• Simulink Block Connections• Observe Simulation Results• Practical Example
![Page 3: Simulink - Introduction with Practical Example](https://reader036.vdocument.in/reader036/viewer/2022062412/58ed8bc91a28abf60d8b4653/html5/thumbnails/3.jpg)
INTRODUCTIONSimulink® is a block diagram environment for multidomain simulation and Model-Based Design. It supports simulation, automatic code generation, and continuous test and verification of embedded systems.
![Page 4: Simulink - Introduction with Practical Example](https://reader036.vdocument.in/reader036/viewer/2022062412/58ed8bc91a28abf60d8b4653/html5/thumbnails/4.jpg)
Model Overview
![Page 5: Simulink - Introduction with Practical Example](https://reader036.vdocument.in/reader036/viewer/2022062412/58ed8bc91a28abf60d8b4653/html5/thumbnails/5.jpg)
Model Overview We can use Simulink® to model a system and then simulate the dynamic behavior of that system.
To create this simple model, we need four Simulink blocks:
1. Sine Wave — Generates an input signal for the model.
2. Integrator — Processes the input signal.3. Bus Creator — Combines the input signal
and processed signal into one signal.4. Scope — Visualizes the signals.
![Page 6: Simulink - Introduction with Practical Example](https://reader036.vdocument.in/reader036/viewer/2022062412/58ed8bc91a28abf60d8b4653/html5/thumbnails/6.jpg)
Simulating this model integrates a sine wave signal to a cosine signal and then displays the result, along with the original signal, in a scope window.
![Page 7: Simulink - Introduction with Practical Example](https://reader036.vdocument.in/reader036/viewer/2022062412/58ed8bc91a28abf60d8b4653/html5/thumbnails/7.jpg)
Simulink Library BrowserFrom the Simulink Library Browser, we can create a new model (block diagram) and search for blocks that we want to use in our model.
![Page 8: Simulink - Introduction with Practical Example](https://reader036.vdocument.in/reader036/viewer/2022062412/58ed8bc91a28abf60d8b4653/html5/thumbnails/8.jpg)
Open Simulink BrowserWe need MATLAB® running before we can open the Simulink Library Browser.
1- From the MATLAB Tool strip, click the Simulink Library button , or in the Command Window, enter “simulink”.
![Page 9: Simulink - Introduction with Practical Example](https://reader036.vdocument.in/reader036/viewer/2022062412/58ed8bc91a28abf60d8b4653/html5/thumbnails/9.jpg)
Set the Library Browser to stay on top of the other desktop windows. On the Library Browser toolbar, select the Stay on top button .
![Page 10: Simulink - Introduction with Practical Example](https://reader036.vdocument.in/reader036/viewer/2022062412/58ed8bc91a28abf60d8b4653/html5/thumbnails/10.jpg)
Browse Specific Blocks
1- From the Simulink Library Browser toolbar, click the New Model button . A Simulink Editor window opens with an new block diagram
![Page 11: Simulink - Introduction with Practical Example](https://reader036.vdocument.in/reader036/viewer/2022062412/58ed8bc91a28abf60d8b4653/html5/thumbnails/11.jpg)
Add Blocks to a ModelTo build a model, begin by copying blocks from the Simulink Library Browser to the Simulink Editor.
1- In the Simulink Library Browser, select the Sources library. The Library Browser displays the source blocks in the library.
![Page 12: Simulink - Introduction with Practical Example](https://reader036.vdocument.in/reader036/viewer/2022062412/58ed8bc91a28abf60d8b4653/html5/thumbnails/12.jpg)
2- Select the Sine Wave block.
![Page 13: Simulink - Introduction with Practical Example](https://reader036.vdocument.in/reader036/viewer/2022062412/58ed8bc91a28abf60d8b4653/html5/thumbnails/13.jpg)
3- Drag the Sine Wave block to the Simulink Editor. A copy of the Sine Wave block appears in model.
![Page 14: Simulink - Introduction with Practical Example](https://reader036.vdocument.in/reader036/viewer/2022062412/58ed8bc91a28abf60d8b4653/html5/thumbnails/14.jpg)
5- Model now has the blocks we need for the simple model.
![Page 15: Simulink - Introduction with Practical Example](https://reader036.vdocument.in/reader036/viewer/2022062412/58ed8bc91a28abf60d8b4653/html5/thumbnails/15.jpg)
Move and Resize Blocks
• Click and drag a block.
• Arrow keys of Keyboard.
![Page 16: Simulink - Introduction with Practical Example](https://reader036.vdocument.in/reader036/viewer/2022062412/58ed8bc91a28abf60d8b4653/html5/thumbnails/16.jpg)
Practical Example
![Page 17: Simulink - Introduction with Practical Example](https://reader036.vdocument.in/reader036/viewer/2022062412/58ed8bc91a28abf60d8b4653/html5/thumbnails/17.jpg)
Starting The Program1- Start MATLAB.
2- Simulink is an extra toolbox that runs on top of MATLAB. To start this, type “simulink” in the Command Window or click on the Simulink icon.
![Page 18: Simulink - Introduction with Practical Example](https://reader036.vdocument.in/reader036/viewer/2022062412/58ed8bc91a28abf60d8b4653/html5/thumbnails/18.jpg)
![Page 19: Simulink - Introduction with Practical Example](https://reader036.vdocument.in/reader036/viewer/2022062412/58ed8bc91a28abf60d8b4653/html5/thumbnails/19.jpg)
3. The Simulink interface should now appear as shown below in Figure
![Page 20: Simulink - Introduction with Practical Example](https://reader036.vdocument.in/reader036/viewer/2022062412/58ed8bc91a28abf60d8b4653/html5/thumbnails/20.jpg)
Example: Simple Model
Build a Simulink model that solves the differential equation
X=4sin(2t)
Initial conditionX(0)=-1
We draw the diagram with help of Simulink library
![Page 21: Simulink - Introduction with Practical Example](https://reader036.vdocument.in/reader036/viewer/2022062412/58ed8bc91a28abf60d8b4653/html5/thumbnails/21.jpg)
• Goes to Simulink library, select sources and then select sine wave.
![Page 22: Simulink - Introduction with Practical Example](https://reader036.vdocument.in/reader036/viewer/2022062412/58ed8bc91a28abf60d8b4653/html5/thumbnails/22.jpg)
• Goes to Simulink library, select continuous and then select Integrator.
![Page 23: Simulink - Introduction with Practical Example](https://reader036.vdocument.in/reader036/viewer/2022062412/58ed8bc91a28abf60d8b4653/html5/thumbnails/23.jpg)
• Goes to Simulink library, select sinks and then select Scope.
![Page 24: Simulink - Introduction with Practical Example](https://reader036.vdocument.in/reader036/viewer/2022062412/58ed8bc91a28abf60d8b4653/html5/thumbnails/24.jpg)
![Page 25: Simulink - Introduction with Practical Example](https://reader036.vdocument.in/reader036/viewer/2022062412/58ed8bc91a28abf60d8b4653/html5/thumbnails/25.jpg)
• Double-click on the Sine Wave block to set amplitude = 4
freq = 2.
• This produces the desired input of 4sin(2t)
![Page 26: Simulink - Introduction with Practical Example](https://reader036.vdocument.in/reader036/viewer/2022062412/58ed8bc91a28abf60d8b4653/html5/thumbnails/26.jpg)
• Double-click on the Integrator block to set
initial condition = -1.
• This sets our IC x(0) = -1.
![Page 27: Simulink - Introduction with Practical Example](https://reader036.vdocument.in/reader036/viewer/2022062412/58ed8bc91a28abf60d8b4653/html5/thumbnails/27.jpg)
Double-click on the Scope to view the simulation results.
![Page 28: Simulink - Introduction with Practical Example](https://reader036.vdocument.in/reader036/viewer/2022062412/58ed8bc91a28abf60d8b4653/html5/thumbnails/28.jpg)
![Page 29: Simulink - Introduction with Practical Example](https://reader036.vdocument.in/reader036/viewer/2022062412/58ed8bc91a28abf60d8b4653/html5/thumbnails/29.jpg)
Show Result of the Model ON Oscilloscope
![Page 30: Simulink - Introduction with Practical Example](https://reader036.vdocument.in/reader036/viewer/2022062412/58ed8bc91a28abf60d8b4653/html5/thumbnails/30.jpg)