Introduction to Simulink

Design of Mechanical Systems 650:486

What is Simulink ?
• Simulink is an extension to Matlab that allows engineers to rapidly and accurately build computer models of dynamical systems using block diagram notation. • Block diagram notation is a graphical means to represent dynamical systems.

Block Diagram Vs Flowchart
• A flowchart describes a sequence of operations, so only one block in the flow chart is active at a time. • A block diagram describes a set of relationships that holds simultaneously, all blocks in a block diagram may be active at once. So block diagram can be thought of being represented by a set of simultaneous equations.

This will open up the window for simulink .Opening up Simulink • At the command prompt for matlab type simulink.

Simulink Basics click the Simulink button the Simulink window .

Simulink Basics click the “new” button create a new model or open an existing one the simulink model window .

• Simple models are linear and time invariant. .Continuous System • Most physical systems are modeled as continuous system since they can be described by using differential equations.

.Four fundamental blocks • The four primitive blocks used to represent continuous linear systems are • Gain block • Sum block • Derivative block • Integrator block.

Simulink window for Continuous system .

Simulink window for Math .

Simulink window for Sources .

Simulink window for Sinks .

Using source and sink blocks .

• y(t)= kx(t) is represented by the following block diagram . The output of the gain block is the input multiplied by a constant.Gain Block • The simplest block diagram element is the gain block.

• The expression • c=a – b is represented by the following block diagram .Sum Block • The sum block permit us to add two or more inputs.

Integrator Block • The integrator block computes the time integral of its input from the starting time to the present. .

Derivative block • The derivative block computes the time rate of change of its input. y = dx/dt .

Example 1 • Solving for a second order constant coefficient linear differential equation d2y/dt2 +c1dy/dt + c0y = b0f(t) For a response to a ‘step’ command .

Simulink Example Get an equivalent block diagram for the system use mouse to drag blocks into the model window and to connect blocks with arrows use integrators to get dy/dt and y .

Simulink Example add gain and summer blocks d2y/dt2 +c1dy/dt + c0y = b0f(t) .

Simulink Example add the step input block Introducing the stepping function .

Simulink Example add the output block .

Simulink Example Now. double click the blocks to open and set the block’s parameters set gain value set initial condition set variable name set output format to “array” .

select Simulation -> Simulation Parameters set Start and Stop time (in seconds) set numerical integration type .Simulink Example To set the simulation parameters….

Simulink Example Time to run the simulation click the “run” button to begin the simulation when the simulation is complete. “Ready” appears at the bottom .

Example Simulink will automatically save a variable named “tout” to the workspace. This variable contains the time values used in the simulation. important for variable time integration types Simulink also will create the output variable(s) you specified >>plot(tout.yoft) .

Example #2 • The block diagram denotes a cart of mass m. on a frictionless surface denoted by the equation of motion : d2x/dt2 = F/m .

Cart Continued • The block diagram of the cart position computation. .

mass as 100 kg.Simulation • Simulating the cart: Using a sine function as force input. .

Simulate the position of the mass. c=10. . k =5.Problem #1 • Consider a spring-massdashpot system represented by the equation of motion: m(d2x/dt2) + c(dx/dt) + kx = F where m=100.

Solution #1 .

5 Hint: use product block .Problem #2 • Represent the differential equation given by dx/dt = bx – px2 where b =1 and p = 0.

Solution #2 .

Sign up to vote on this title
UsefulNot useful