Simulink
Simulink
Simulink
Simulink Overview
Simulink is the environment for the multi domain simulation of modelbased design for dynamic and embedded systems Helps you design, build and simulate models of Aerospace and Defense Control Automotive Communications Electronics and Signal Processing Medical Instrumentation
Introduction
Use keyword search to find required model block See the documentation on how to use it
Introduction 3
To connect, you can simply drag a line between inputs and outputs
Or alternatively, select first block, hold CTRL, click on the second block
Example 1, Continue
Lets run it with default parameters value Now change the parameters Scope Parameters Gain parameter Change the sine wave form to a vector Making copies
Introduction
x 3sin 2t
x ( 0 ) 1.
Analytical Solution
x(t ) 1 3 cos2t 2 2
Modeling
3 sin 2t
x(t )
x ( 0 ) 1
3sin(2t) (input)
1 s
x(t) (output)
integrator
Modeling
Double click on scope to view simulation results Run the simulation by clicking on the RUN Button
x(t ) 1 3 cos2t 2 2
Modeling
Display block's parameters Double click on the block Flip a block Rotate a block (clockwise 90 deg @ each keystroke) Changing blocks' names Disconnecting a block Drawing a diagonal line CTRL-I CTRL-R Click on block's label and position the cursor to desired place. hold down the SHIFT key and drag the block to a new location hold down the SHIFT key while dragging the mouse with the left button
Dividing a line
move the cursor to the line to where you want to create the vertex and use the left button on the mouse to drag the line while holding down the SHIFT key
Saving Data
You can set the parameters to variables and set them in MATLAB workspace From Workspace, To workspace From File and To File Logging data, right click on signal and check the log signal data
Saving Data
10
Using Subsystems
Used to hide details and simplify the appearance In view, Model Browser option To make subsystem select some graphs and right click create subsystem Masking also helps to create parameters to change the subsystems Right click on subsystem Mask subsystem Appearance, Ports, Parameters, can be set
Subsystems
11
Coding in Simulink
12
Using Solvers
Using Play, pause, setting the simulation time Simulink Engine takes care of numerical caluclations Default solver is accurate and fast relatively Change the solver in configuration parameters Variable-step Vs. fix-step
Using solvers
13
Problem 2:
2nd-order mass-spring-damper system
m cx kx f (t ) x
zero ICs input f(t) is a step with magnitude 3 parameters: m = 1, c = 2, k = 4
Modeling
14
m f (t ) cx kx x
m x
Drag a sum block, and set its signs to +-- for f (t ) , cx and kx respectively.
Modeling
15
m x
1 m
m x
summing block
Add a scope
1 m
1 s
1 s
Modeling
16
f(t) input
+ -
m 1 x m
1 s
c
x x
k
1 s
x(t) output
c x
kx
Put the Step Function and Scope for Input and Output.
Modeling
17
Modeling Problems
18
Other Libraries
Simscape modeling and simulating multidomain physical systems, such as those with mechanical, hydraulic, and electrical components Serve as platform for SimHydraulics, SimDriveline, SimMechanics, SimElectronics & SimPowerSystems. Simmechanics Based on Simscape, platform product for the Simulink Physical Modeling family Simulation of rigid body machines and their motions Some good examples Http://www.mathworks.com/help/toolbox/physmod/mech/exampl eindex.html
Other libraries
19
References
http://edu.levitas.net/Tutorials/Matlab/Simulink/ http://www.me.cmu.edu/ctms/modeling/tutorial/simulinkmodeling/ma inframes.htm http://www.mathworks.com/products/simulink/demos.html?show=de mo
References
20