0% found this document useful (0 votes)
9 views11 pages

Chapter 4-3

The document outlines a series of tasks related to solving a system of differential equations using MATLAB's ode45 function. It includes instructions for creating mass, stiffness, damping matrices, and force vectors, as well as plotting the solutions for multiple masses. The document emphasizes comparing system responses under different initial conditions and mass values.

Uploaded by

Hussein Salameh
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)
9 views11 pages

Chapter 4-3

The document outlines a series of tasks related to solving a system of differential equations using MATLAB's ode45 function. It includes instructions for creating mass, stiffness, damping matrices, and force vectors, as well as plotting the solutions for multiple masses. The document emphasizes comparing system responses under different initial conditions and mass values.

Uploaded by

Hussein Salameh
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/ 11

School of Engineering

Department of Mechanical Engineering


Fall 2020-2021

Chapter 4 (3)

1
[t,x] = ode45(‘function name’, tspan, xspan)

A column vector Name of function file that A row (or column) vector
and n rows evaluates the right side of 1 st containing the initial
containing the order differential equation of conditions of
values of time form : displacements and
starting from t0 velocities for all masses
till tf

A row (or column) vector containing


A matrix containing m the starting and ending values of t
columns and n rows. Ex: tspan = [t0 tf] OR [t0;tf]
m = 2*number of DOF OR tspan = t0:increment:tf

2
3
a. Write the mass matrix M, the stiffness matrix K,
the damping matrix C and the force vector F.

b. Transform the equation of motion into 1 st ODEs.

c. Using ode45, find the solutions of this system.

d. Plot the solutions (x1(t) and v1(t)) of the first mass


on the same figure. Write the legend.

e. Plot the solutions (x2(t) and v2(t)) of the second


mass on a new figure. Write the legend.

4
f. Compare the displacement x1(t) of this system and the
displacement q1(t) if the system is free.

g. Compare the velocity v2(t) of the initial system and the


velocity r2(t) if all the initial conditions are zeros.

h. Plot, using subplot, the displacement x2(t) of the initial


system for
m2 = 1kg, 2 kg, 5 kg, 10 kg and 100 kg

i. Plot the displacements of part h on the same graph.


Write the legend.

5
 The mass matrix M

 The stiffness matrix K

 The damping matrix C

 The force vector F

6
zeros(2,1)

7
 Create a function:
function [zdot] = DOF_2 (t , z)
% Define all the needed parameters here
% Write the 1 OD equation
st

end

 On a Script, use ode45 to find the solutions:


- Define tspan
- Define xspan
[time , X] = ode45(‘DOF_2’,tspan,xspan)

8
 Create a new function where the forces are zeros.

function [zdot] = DOF_2f (t , z)


% Define all the needed parameters here with forces=0
% Write the 1 OD equation
st

end

 On the Script, write


[tf,q] = ode45(‘DOF_2f’,tspan,xspan)

 Plot x1(t) and the displacement q1(t) on the same


figure.
Write the legend.

9
 On the same Script, define new values of initial
conditions (newxspan) where all the values are
zeros.
[tg , r] = ode45(‘DOF_2’,tspan,newxspan)

 Plot v2(t) and the velocity of the second mass of


the new system on the same figure.
Write the legend.

10
 Create a new function where m2 is a global variable

function [zdot] = DOF_2h (t , z)


% Define all the needed parameters here with m2 is a global
variable
% Write the 1 OD equation
st

end

 On the Script, find the solutions for different values of m2.


[th , xh] = ode45(‘DOF_2h’,tspan,xspan)

 Using subplot, plot x2(t) for different values of m2.


Write the title for each graph.

 Plot all the displacements of Part h on the same graph.


Write the legend.

11

You might also like