ode45 error **help please**

2 visualizaciones (últimos 30 días)
nb1
nb1 el 18 de Oct. de 2019
Editada: nb1 el 18 de Oct. de 2019
My code, which I am 95% sure is correct, is the following:
function yprime = ex3_2ndorder(x,y)
%name and date
yprime=zeros(2,1);
yprime(1)=y(2);
yprime(2)=exp(x)-4*y(2)-3*y(1);
end
When I run it, it tells me there are not enough input arguments and that the error is in line 4, yprime(1)=y(2);
The ODE I am trying to solve is z"+4z'+3z=e^x, z(0)=1, z'(0)=2
Any help would be greatly appreciated :)

Respuestas (1)

Walter Roberson
Walter Roberson el 18 de Oct. de 2019
ode45(@ex3_2ndorder, stuff
You probably left out the @

Categorías

Más información sobre Ordinary Differential Equations en Help Center y File Exchange.

Etiquetas

Productos

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by