Write a function that applies Euler's
古いコメントを表示
I'm working on the topic: "Write a function applying the Euler method, approximate function y(x): function [x,y]" but got an error at "Error in Ole2 (line 2)fxy = matlabFunction(f)"
code:
function [x,y] = Ole(f, xfirst, xlast, y0, N)
fxy = matlabFunction(f);
h = (xlast - xfirst)/N;
x = xfirst:h:xlast;
y = x;
y(1) = y0;
for i = 1:N y(i+1) = y(i) + h*fxy(x(i),y(i));
end
end
1 件のコメント
Torsten
2022 年 12 月 17 日
The reason for the error lies the way you call "Ole", not in the function code that you posted itself.
採用された回答
その他の回答 (0 件)
カテゴリ
ヘルプ センター および File Exchange で Fluid Dynamics についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!