You are on page 1of 17

VIET NAM NATIONAL UNIVERSITY, HO CHI MINH CITY

HO CHI MINH CITY UNIVERSITY OF TECHNOLOGY

GROUP 12’S MATLAB


PROJECT REPORT

Supervisor: Lê Nhật Tân

Project 12 – General Physics 1


Study of oscillations

1
Group Information:
Group No: 12 Class: CC16
Completion day: December 20th, 2022

Name ID
1. Nguyễn Minh Hoàng 2252232
2. Dương Thanh Phước 2252659
3. Mai Quốc Thăng 2252761

2
Table of Contents
I. Introduction..........................................................4

II. Theory.................................................................5

III. MATLAB code and explanation.....................6

IV. Result and analysis............................................8

V. Conclusion.........................................................17

VI. References........................................................17

3
I. Introduction
 Oscillatory Motion is defined as a periodic motion in which the
particles move from one place to another on a particular
predetermined path within equal time intervals.

 The ideal condition is that the object can be in oscillatory motion


forever in the absence of friction but in the real world, this is not
possible, and the object has to settle into equilibrium.

 Examples of oscillation motions are all around us: The motion of the
swings, the motion of the pendulum, our heartbeats, etc.

 Simple Harmonic Motion is defined as an oscillatory motion in which


the restoring force is directly proportional to the displacement of the
body from its mean position. The direction of this restoring force is
always towards the mean position.

4
II. Theory
The oscillation of any body due to elastic force can be described by the
differential equation:

Where:
y: Oscillation displacement,
b: Damped coefficient,
0: Angular frequency of free oscillation,
: Angular frequency of stimulating force.

5
III. MATLAB code and explanation

 Formulate the differential equation of the oscillation motion with


initial conditions included (the “figure” command is used to show the
graph after the calculations are finished):

figure
syms y t
clc
disp('enter value');
omega0 = input('enter omega: omega0(rad/s) = ');
b = input('enter damping coefficient: b = ');
F = input('enter force: F(N) = ');
t0 = input('enter time to start: t(s) = ');

 Solve the differential equation using the command dsolve in


MATLAB symbolic calculation:

if F == 0
disp('Function of oscillation displacement: ')
y = collect(dsolve(['D2y +',num2str(b),'*Dy +
(',num2str(omega0),'^2)*y = 0'],['y(0) = 5'],['Dy(0) = 0'],['t']),t)
else
omega = input('enter omega of stimulus force: omega(rad/s) = ');
disp('Function: ')
y = collect(dsolve(['D2y +',num2str(b),'*Dy +
(',num2str(omega0),'^2)*y = ',num2str(F),'*cos(',num2str(omega),'*t)'],
['y(0) = 5'],['Dy(0) = 0'],['t']),t)
end;

6
 Plot the graph depending on time (with given initial conditions y(0) =
5; y’(0) = 0):

disp('graph of oscillation displacement with time: ')


ezplot(y,[0 t0])
grid on
xlabel('Time t(s)')
ylabel('displacement y(m)')
title('graph of oscillation displacement y with time t')

7
IV. Result and analysis
a) Harmonic oscillation (0 = 3; b = F = 0; t = 20s)

b) Damped oscillation (0 = 10; b = 0.01, 0.1, 1.0, 10.0; F = 0; t = 20s) %


many values of b

 0 = 10; b = 0.01; F = 0; t = 20s

8
 0 = 10; b = 0.1; F = 0; t = 20s

9
 0 = 10; b = 1.0; F = 0; t = 20s

10
 0 = 10; b = 10; F = 0; t = 20s

11
c) Stimulated oscillation (0 = 10; b = 0.1; F = 10;  = 10.0, 5.0, 3.0, 0.0; t
= 150s) % many values of 
 0 = 10; b = 0.1; F = 10;  = 10.0; t = 150s

12
 0 = 10; b = 0.1; F = 10;  = 5.0; t = 150s

13
 0 = 10; b = 0.1; F = 10;  = 3.0; t = 150

14
 0 = 10; b = 0.1; F = 10;  = 0.0; t = 150s

15
 All the above results match the results calculated manually,
proving other values can be replaced in and special situations can be
easily plotted and studied through MATLAB symbolic calculation
and graphical interpretation.

16
V. Conclusion
The project has successfully computed the solution of the
oscillatory motion using MATLAB’s symbolic calculation. With this
tool we can solve complex motion cases that cannot be solved by the
analytical method.

VI. References
A. L. Garcia and C. Penland, MATLAB Projects for Scientists and
Engineers, Prentice Hall, Upper Saddle River, NJ, 1996.
http://www.algarcia.org/fishbane/fishbane.html.
https://www.mathworks.com/matlabcentral/fileexchange/2268-
projects-for-scientists-and-engineers

17

You might also like