# Study of oscillations and how to solve in MATLAB

66 views (last 30 days)
Khang Ngo on 15 May 2021
Edited: Khang Ngo on 17 May 2021
The oscillation of any body due to elastic force can be described by the differential equation:
y''+b*y'+(w0^2)*y =F*cos(w*t)
In which, y is oscillation displacement, b is damped coefficient, w0 is angular frequency of free oscillation, w is angular frequency of stimulating force.
This project requires students to use Matlab to solve above equation to study harmonic oscillation (no damped, no stimulated force: b = F = 0), damped oscillation (b not equal 0, F = 0), stimulated oscilation (b not equal 0, F not equal 0).
- Examine the command dsolve to solve differential equation in MATLAB symbolic calculation.
- Write Matlab program to solve and plot the graph depending on time (with initial conditions y(0) = 5; y’(0) = 0):
a) harmonic oscillation (w0 = 3; b = F = 0; t = 20s)
b) damped oscillation (w0 = 10; b = 0.01, 0.1, 1.0, 10.0 ; F = 0; t = 20s) % many values of b
c) stimulated oscilation (w0 = 10; b = 0.1 ; F = 10; w= 10.0, 5.0, 3.0, 0.0; t = 150s ) % many values of w
- Discuss about the obtained results.
Please somebody can help me deal with this problem, and explain me why we have this solution, I am a newbie and trying to improve my skill day by day.Thank you.

Sulaymon Eshkabilov on 15 May 2021
This is a quite straight forward exercise. Follow these steps and run your different case scenarios:
syms y(t)
Dy = diff(y, t);
D2y = diff(Dy, t);
b = 0; F = 0; w0=3; % Harmonic MOTION. Free motion: no damping and no force applied
w=10;
SOL = dsolve(D2y==F*cos(w0*t)-b*Dy-y*w0^2, y(0)==0, Dy(0)==5);
fplot(SOL, [0, 20]), shg
%% Similarly simulate the other cases, as well. And compare your sim. results and discuss.
Good luck
Khang Ngo on 17 May 2021
Does it right for the third case?
And why it has only 3 lines, I thought it has 4 instead.