Docsity

Getting Started With Simulink-Matlab-Manual, Slides of Matlab skills

Partial preview of the text

Download Getting Started With Simulink-Matlab-Manual and more Slides Matlab skills in PDF only on Docsity!

Getting started with Simulink

MS Process Engineering 1st^ & 4th^ Semester

Before we start

 You should have network access to software through Application Explorer on your desktop.  If not, contact the Technical Services Center (TSC):  Help Desk at 877-  Dial 6000 and say "Help Desk"  Visit the TSC in Crapo Hall, Room G-  E-mail to [email protected]

Launch Simulink

In the MATLAB command window, at the >> prompt, type simulink and press  Enter

Create a new model

 Click the new-model icon in the upper left corner to start a new Simulink file

 Select the Simulink icon to obtain elements of the model

Save your model

 You might create a new folder, like the one

shown below, called simulink_files

 Use the .mdl suffix when saving

Example 1: a simple model

 Build a Simulink model that solves the

differential equation

 Initial condition

 First, sketch a simulation diagram of

this mathematical model (equation)

x   3 sin 2 t 

x ( 0 )   1.

Select an input block

Drag a Sine Wave block

from the Sources library

to the model window

Select an operator block

Drag an Integrator block

from the Continuous library

to the model window

Connect blocks with signals

 Place your cursor on the output port (>) of the Sine Wave block

 Drag from the Sine Wave output to the Integrator input

 Drag from the Integrator output to the Scope input Arrows indicate the direction of the signal flow.

Select simulation parameters

Double-click on

the Sine Wave

block to set amplitude = 3 and freq = 2.

This produces the desired input of 3sin(2 t )

Select simulation parameters

Double-click on

the Scope to view

the simulation results

Run the simulation

In the model window, from the

Simulation pull-

down menu,

select Start

View the output

x(t) in the Scope

window.

Example 2

 Build a Simulink model that solves the

following differential equation

 2nd-order mass-spring-damper system  zero ICs  input f(t) is a step with magnitude 3  parameters: m = 0.25, c = 0.5, k = 1

m  x  cx   kx  f ( t )

Create the simulation diagram

 On the following slides:

 The simulation diagram for solving the ODE is created step by step.  After each step, elements are added to the Simulink model.

 Optional exercise: first, sketch the

complete diagram

m  x  cx   kx  f ( t )