represent the following differential equation as a function: d2y(t)/dt2 + 1000*dy(t)/dt + 1000000*y(t) = 1000000*x(t) in matlab

main.m
function dydt = myODE(t, y, x)
    dydt = zeros(2,1);
    dydt(1) = y(2);
    dydt(2) = 1000000*x - 1000000*y(1) - 1000*y(2);
end
130 chars
6 lines

You would then use this function myODE in an ODE solver like ode45 or ode15s to solve the differential equation.

gistlibby LogSnag