Week 11
Week 11
Department of Mechatronics
School of Mechanical Engineering
VIBRATION
SOFTWARE PRACTICE
CONTENTS
• Introduction
• Practice
Simulink
• Introduction
• Practice
Script file in Matlab
Matlab Script files
a series of commands typed into the
editor window, aka. m-file
The variables used in the m-file are
placed in the Matlab workspace.
This workspace is empty when
Matlab is started, and it will contain
all the variables defined in the
session.
If we want to delete all variables, we
use the clear all command
Script file in Matlab
Script file in Matlab
m-file function
function [output 1, output 2] = function_name(input1,input2)
% Some comments that explain what the function does go
here.
global xyz
persistent abc
MATLAB command 1;
MATLAB command 2;
MATLAB command 3;
output 1 = ….;
output 2 = ….;
PRACTICE
Ex1
Given: ,
PRACTICE
Ex1
PRACTICE
Ex1
0.05
0.04
0.03
0.02
0.01
-0.01
0 2 4 6 8 10 12
PRACTICE
Ex1
0.05
0.04
0.03
0.02
0.01
-0.01
0 2 4 6 8 10 12
PRACTICE
Ex2
Given: ,
PRACTICE
Ex2
function v=dsys2(t,y)
-1
-2
-3
-4
0 1 2 3 4 5 6 7 8
t[s]
Practice
Ex3 – 2DOF vibration
Solve the ODEs in the time interval [0, 10]
IC:
[T,Y]=ode45(@func,[0 10],[1;2;3;4]);
plot(T,Y)
function ff=func(t,y)
M=[5 2;2 4];C=[0.1 0;0 0.1];
K=[10 5;5 20];f=[0;3*sin(t)];
A=[zeros(2) eye(2);-M\K –M\D];
h=[zeros(2,1);M\f];
ff=A*y+h;
end
PRACTICE
HW
Given: ,
Consider in 2 cases:
SIMULINK
Introduction
Allows simulation of dynamic systems with a special
graphical interface using interconnected blocks.
SIMULINK
Introduction
-Click or type:
->> simulink
Simulink’s
symbol
SIMULINK
Introduction
Sources: used to generate various signals
BLOCKS POSITION
Ramp Sources
Constant Sources
Gain Math Operation
Add hoặc Sum Math Operation
Scope Sinks
PRACTICE
Ex1
BLOCKS POSITION
Ramp Sources
Constant Sources
Gain Math Operation
Add hoặc Sum Math Operation
Scope Sinks
PRACTICE
Ex1
PRACTICE
Ex2
Consider a system as followings:
PRACTICE
Ex3 – 1DOF vibration x
k
PRACTICE
Ex3 – 1DOF vibration
PRACTICE
Ex4 – 2DOF vibration
IC