MATLAB: Second order differential equation with variable coefficients

differential equations

I have to solve this differential equation: m*d^2x/dt^2 +k*x= F(x) where F(x) is known for points

Best Answer

Write your equation as a first-order system
y1'=y2
y2'=(-k*y1+F(y1))/m
use "interp1" to interpolate F(y1) from your known values and call "ode45" to solve.
Best wishes
Torsten.