ode45 too many input arguments
30 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Opariuc Andrei
el 10 de Dic. de 2020
Comentada: Star Strider
el 11 de Dic. de 2020
so i got a function which i did as home work a few days ago tested it ,it ran ,now it doesn't want to run anymore i don't know how to fix it ,because i want to do a few more examples of ode45 and i get same error . The files have not been opened/modified since i wrote/tested them .
the function (which is saved correctly)
function dy=ec1L10(x,y)
dy=4*exp(0.8*x)-0.5*y
and the script
[x y]=ode45('ec1L10',0:0.25:4,2);
plot(x,y);grid on ; axis tight;
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/457374/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/457379/image.png)
0 comentarios
Respuesta aceptada
Star Strider
el 10 de Dic. de 2020
To use your original construction, the single quotes are no longer acceptable..
Instead:
[x y]=ode45(@ec1L10,0:0.25:4,2);
would work.
However ‘ec1L10’ can be written as an anonymous function:
ec1L10 = @(x,y) 4*exp(0.8*x)-0.5*y;
so the rest of that code becomes:
[x y]=ode45(ec1L10,0:0.25:4,2);
plot(x,y);
grid on
axis tight
.
4 comentarios
Más respuestas (1)
Steven Lord
el 10 de Dic. de 2020
Let's check if you're using the ode45 function included in MATLAB. What does this function show? It should show just one function inside the toolbox/matlab/funfun subdirectory under matlabroot.
which -all ode45
3 comentarios
Ver también
Categorías
Más información sobre Ordinary Differential Equations en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!