0% found this document useful (0 votes)
137 views24 pages

Simulink Tutorial for Beginners

This document provides a tutorial on getting started with Simulink in Matlab. It explains how to launch Simulink, create a new model, and save models. It then walks through an example of building a simple model to solve a differential equation. The steps include sketching the block diagram, selecting and connecting the appropriate blocks like Constant, Sum, Integrator, and Scope blocks, setting parameters, running the simulation, and verifying the results match the analytical solution.

Uploaded by

5wolf7
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
137 views24 pages

Simulink Tutorial for Beginners

This document provides a tutorial on getting started with Simulink in Matlab. It explains how to launch Simulink, create a new model, and save models. It then walks through an example of building a simple model to solve a differential equation. The steps include sketching the block diagram, selecting and connecting the appropriate blocks like Constant, Sum, Integrator, and Scope blocks, setting parameters, running the simulation, and verifying the results match the analytical solution.

Uploaded by

5wolf7
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 24

Getting Started with Matlab Simulink

A Simulink tutorial

Before we start
You should have access to Matlab and Simulink software through the laboratory computers in Fryklund Hall.

Controls and Instrumentation

Slide 2

Launch Matlab Simulink


[All Program] Matlab Launch Simulink

Controls and Instrumentation

Slide 3

Create a new model


Create a new model from the Simulink Library window Browser Click the new-model icon in the upper left corner to start a new Simulink file Select and expand the Simulink icon to obtain elements of the model

Controls and Instrumentation

Slide 4

Workspace in Simulink
Library of elements Model is created in this window

Controls and Instrumentation

Slide 5

Save your Model


You might create a new folder to save your Simulink files. The saved Simulink files should have .mdl suffix with the file names.

Controls and Instrumentation

Slide 6

Example 1: A Simple Model


Build a Simulink model that solves the differential equation y(t) y(t) 0 Initial condition: y(0) = 0.01 The analytical solution
y(t ) 0.01 e t t 0

First, sketch a block diagram of this mathematical model (equation) in Simulink.

Controls and Instrumentation

Slide 7

Block Diagram in Simulink


The differential equation: y(t) y(t) 0
y(0) 0.01
y

0 (input)

1 s

y (t) (output)

integrator Output is the solution of the differential equation y (t)


MFGE 363 Controls and Instrumentation Slide 8

Block Diagram in Simulink


First, solve for the term with highest-order derivative

y(t) 0 y(t)
Make the left-hand side of this equation the output of a summing block as shown in the block diagram on the next slide

Controls and Instrumentation

Slide 9

Block Diagram for the DEQ


y (t ) y(t ) 0 can be re-arrange as y (t ) 0 y(t )
y (t )

y (t )

Controls and Instrumentation

Slide 10

Select an Input Block


Drag a Constant block from the Sources library to the model window

Controls and Instrumentation

Slide 11

Select a SUM Block


Drag a SUM block from the Math Operations library to the model window

Math Operations

Controls and Instrumentation

Slide 12

Select an Integrator Block


Drag an Integrator block from the Continuous library to the model window

Controls and Instrumentation

Slide 13

Select a Scope Block


Drag a Scope block from the Sinks library to the model window

Controls and Instrumentation

Slide 14

Select a Gain Block


Drag a Gain block from the Math Operation library to the model window

Controls and Instrumentation

Slide 15

Connect Blocks with Signals


Place your cursor on the output port (>) of the Constant block Left click the mouse and drag from the Constant output port to the Sum input Drag from the SUM output to the input of the integrator input port

Connect the scope and gain blocks

Arrows indicate the direction of the signal flow.

Controls and Instrumentation

Slide 16

Select Simulation Parameters


Double-click on the Constant block to set Constant value = 0.

Controls and Instrumentation

Slide 17

Select Simulation Parameters


Change the sign of the sum block to +- in the field of List of signs

Controls and Instrumentation

Slide 18

Select Simulation Parameters


Double-click on the Integrator block to set initial condition = 0.01. This sets our I.C. y (0) = 0.01.

Controls and Instrumentation

Slide 19

Select Simulation Parameters


Double-click on the Gain block to set gain = 1.

Controls and Instrumentation

Slide 20

Select Simulation Parameters


Double-click on the Scope to view the simulation results

Controls and Instrumentation

Slide 21

Run the Simulation


In the model window, from the Simulation pulldown menu, select

Start

Controls and Instrumentation

Slide 22

View the Simulation


Click on Auto-scale and view the output y (t) in the Scope window. Auto scale

Controls and Instrumentation

Slide 23

Simulation Results
To verify that this plot represents the solution to the problem, solve the equation analytically. The analytical result,

y(t ) 0.01 e t t 0
matches the plot (the simulation result) exactly.

Controls and Instrumentation

Slide 24

You might also like