[Math] Second order differential equations using MATLAB

MATLABordinary differential equations

I'm trying to input a second order differential equation to solve into matlab over x = 0 to x =1. I can't figure out how. Here's the equation:

$\displaystyle y'' = 1 + 0.1 \sqrt{1+(y')^2}$

with initial conditions at zero.

Best Answer

MATLAB doesn't support second order differential equations outright; it's your job to turn your problem into a system of first order differential equations, as mentioned here.

To wit, first construct the appropriate function:

function dy = rapidash(t,y)
dy = zeros(2,1);
dy(1) = y(2);
dy(2) = 1+0.1*sqrt(1+y(2).^2);

and, using ode45() as an example, ode45(@rapidash,[0,1],(conditions)).