Use - depending on your boundary conditions - ODE45 or BVP4c and set up the system as
y1'=y2
y2'=y3
y3'=y4
y4'=y5
y5'=y6
y6'=-2*y5-y3-f(x)
Best wishes
Torsten.
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!