0% found this document useful (0 votes)
29 views

Week 11

Here are the steps to solve this problem in Simulink: 1. Create a new Simulink model 2. Add the following blocks from the Library Browser: - Integrator (for x1, x2, x3, x4) - Gain (for k1, k2, c1, c2) - Sum (to calculate force terms) 3. Connect the blocks as dictated by the equations of motion 4. Add an Input block (Step or Ramp) to provide the input force f 5. Add a Scope block to monitor the outputs x1, x2, x3, x4 6. Set the initial conditions of the integrators to the given IC

Uploaded by

Vu Quoc Trung
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
29 views

Week 11

Here are the steps to solve this problem in Simulink: 1. Create a new Simulink model 2. Add the following blocks from the Library Browser: - Integrator (for x1, x2, x3, x4) - Gain (for k1, k2, c1, c2) - Sum (to calculate force terms) 3. Connect the blocks as dictated by the equations of motion 4. Add an Input block (Step or Ramp) to provide the input force f 5. Add a Scope block to monitor the outputs x1, x2, x3, x4 6. Set the initial conditions of the integrators to the given IC

Uploaded by

Vu Quoc Trung
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 40

Group of Applied Mechanics,

Department of Mechatronics
School of Mechanical Engineering

VIBRATION

SOFTWARE PRACTICE
CONTENTS

Script file in MATLAB

• 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

Determine vibration response of following EOM:

Given: ,
PRACTICE
Ex1
PRACTICE
Ex1

1. Solution form: when :


PRACTICE
Ex1
clear all;
F0=30; k=1000; m=100; c=63; t0=2;
w0=sqrt(k/m); D=c/(2*m*w0);
theta=atan(D/(1-D^2));
wd=w0*sqrt(1-D^2);
t=0:0.01:12;
for i=1:length(t)
if t(i)<t0,F(i)=0; else F(i)=F0; end;
xa(i)=F(i)/k-F(i)/(k*sqrt(1-D^2))*exp(-D*w0*(t(i)-
t0))*cos(wd*(t(i)-t0)-theta);
end;
figure; plot(t,xa);
PRACTICE
Ex1
0.06

0.05

0.04

0.03

0.02

0.01

-0.01
0 2 4 6 8 10 12
PRACTICE
Ex1

2. Convert into 1st order:

Using new variables


PRACTICE
Ex1
function v=dsys1(t,y)
% convert into 1st order equation
F0=30; k=1000; m=100; c=63; t0=2;
w0=sqrt(k/m); D=c/(2*m*w0);
if t<t0, F=0; else F=F0; end
v=[y(2); y(2)*(-2*D*w0)+y(1)*(-w0^2)+F/m];

%-----------use ode45 function-------------


y0=[0;0]; ts=[0 12];
[t,y]=ode45('dsys1',ts,y0);
plot(t,y(:,1)); grid on;
set(gca,'Xlim',[min(t) max(t)]); hold off
PRACTICE
Ex1
0.06

0.05

0.04

0.03

0.02

0.01

-0.01
0 2 4 6 8 10 12
PRACTICE
Ex2

Determine vibration response in period of following EOM:

Given: ,
PRACTICE
Ex2
function v=dsys2(t,y)

k=5000; m=20; c=40; T=4;


w0=sqrt(k/m);
if t>=0 & t<T/2,
F=4/T*t-1;
elseif t>=T/2 & t<=T,
F=1-4/T*(t-T/2);
elseif t>=T & t<3*T/2,
F=4/T*(t-T)-1;
elseif t>=3*T/2 & t<=2*T,
F=1-4/T*(t-3*T/2);
end;
v=[y(2); y(1)*(-k/m)+y(2)*(-c/m)+F/m];
PRACTICE
Ex2
%-----------Tinh toan bang tich phan so--------------
clc
clear all;
T=4; y0=[0;0]; ts=[0 2*T];
[t,y]=ode45('dsys2',ts,y0);
plot(t,y(:,1),'k','Linewidth',1); title('Bien do dao
dong');
xlabel('t[s]'), ylabel('x(t)');
set(gca,'Xlim',[min(t) max(t)]); grid on;
PRACTICE
Ex2
10 -4 Amplitude
3

-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

Determine vibration response in period of following EOM:

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

Sinks: used to output or display signals

Continuous: continuous-time system elements (transfer functions, state-


space models, PID controllers, etc.)

Discrete: linear, discrete-time system elements (discrete transfer


functions, discrete state-space models, etc.)

Math Operations: contains many common math operations (gain, sum,


product, absolute value, etc.)

Ports & Subsystems: contains useful blocks to build a system


SIMULINK BLOCKS
SOURCE
SIMULINK BLOCKS
SOURCE
SIMULINK BLOCKS
SINKS
SIMULINK BLOCKS
MATH OPERATIONS
SIMULINK BLOCKS
MATH OPERATIONS
SIMULINK BLOCKS
DISCRETE
SIMULINK BLOCKS
DISCRETE
SIMULINK BLOCKS
DISCRETE
SIMULINK BLOCKS
Ports & Subsystems
PRACTICE
Ex1

Convert from Celsius degree into Fahrenheit degree

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

Consider a system as followings: c


m

k
PRACTICE
Ex3 – 1DOF vibration
PRACTICE
Ex4 – 2DOF vibration

Consider 2dof system as followings:


PRACTICE
Ex4 – 2DOF vibration
Exercises

Consider the ODEs

IC

You might also like