MATLAB ODE45 solver study
MATLAB ODE45 solver study
Skills or knowledge: Knowledge of ODE45 solver
Software or programs used: MATLAB programming
Project: Solving a spring mass damper system ODE using the ODE45 solver in Matlab and studying the effect of damping coefficient on the solution.
MATLAB ODE45 solver: ODE45 solver in MATLAB is a solver for initial value ordinary differential equation problems .The ODE45 solver uses fourth order Runge –Kutta numerical method for solving the ODEs.It is an explicit solver .
Problem definition:
The spring –mass damper system problem is used for the ODE45 solver validation.The system consists of mass m= 50kg, spring of stiffness k= 100 and damper with damping coefficient c =5,10 and 15.
The solution of the ODE will be obtained ,the displacement plot will be plotted at different values of the damping coefficient , to examine the effect of damping on the displacement oscillations.
ODE for the problem:
M*(d^2(x)/dt^2) + C *(d(x)/dt) + Kx = F0*sin(wt)
Where M= mass (Kg)
C= damping coefficient
K = stiffness of spring
t = time (s)
MATLAB code for the ODE45 solver:
The ODE45 solver gives the solution for the displacement,velocity and acceleration of spring –damper –mass system.
The displacement of the mass was plotted with time (t), at different values of c (damping coefficient ).
From the plots it can be observed that the oscillations in the displacement are damped with increase of the damping coefficient (c) , as expected.
Results:
The ODE45 solver in MATLAB was used to solve a second order ordinary differential equation based on a spring-mass-damper system.The initial value problem was solved and the displacement solution plot was plotted at different values of the damping coefficient c,to examine the effect of damping on the displacement .
ODE45 solver code MATLAB
MATLAB function