simulink - introduction with practical example

Post on 12-Apr-2017

104 Views

Category:

Technology

5 Downloads

Preview:

Click to see full reader

TRANSCRIPT

Presentationon

SIMULINK

By: Kamran Gillani

Contents:• Introduction• Model Overview• Define Parameters• Simulink Block Connections• Observe Simulation Results• Practical Example

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.

Model Overview

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.

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.

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.

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”.

Set the Library Browser to stay on top of the other desktop windows. On the Library Browser toolbar, select the Stay on top button  .

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

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.

2- Select the Sine Wave block.

3- Drag the Sine Wave block to the Simulink Editor. A copy of the Sine Wave block appears in model.

5- Model now has the blocks we need for the simple model.

Move and Resize Blocks

• Click and drag a block.

• Arrow keys of Keyboard.

Practical Example

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.

3. The Simulink interface should now appear as shown below in Figure

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

• Goes to Simulink library, select sources and then select sine wave.

• Goes to Simulink library, select continuous and then select Integrator.

• Goes to Simulink library, select sinks and then select Scope.

• Double-click on the Sine Wave block to set amplitude = 4

freq = 2.

• This produces the desired input of 4sin(2t)

• Double-click on the Integrator block to set

initial condition = -1.

• This sets our IC x(0) = -1.

Double-click on the Scope to view the simulation results.

Show Result of the Model ON Oscilloscope

top related