ode45 too many input arguments

24 ビュー (過去 30 日間)
Opariuc Andrei
Opariuc Andrei 2020 年 12 月 10 日
コメント済み: Star Strider 2020 年 12 月 11 日
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)
and the script
[x y]=ode45('ec1L10',0:0.25:4,2);
plot(x,y);grid on ; axis tight;


Star Strider
Star Strider 2020 年 12 月 10 日
To use your original construction, the single quotes are no longer acceptable..
[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);
grid on
axis tight
  4 件のコメント
Star Strider
Star Strider 2020 年 12 月 11 日
As always, my pleasure!
Thank you! Maybe some day ...


その他の回答 (1 件)

Steven Lord
Steven Lord 2020 年 12 月 10 日
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 件のコメント
Opariuc Andrei
Opariuc Andrei 2020 年 12 月 11 日
i removed and all my ode45 work fine . thx :)



Find more on Programming in Help Center and File Exchange





Community Treasure Hunt

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

Start Hunting!

Translated by