Error using Euler Method
7 ビュー (過去 30 日間)
古いコメントを表示
I am trying to find the approximate value for N=50and this is the code I have written:
f =inline('0.7*y','t','y') ;
t = linspace (0 ,5 ,100);
y = -2* exp (0.7* t ); % define exact solution of the ODE
[ t50 , y50 ]= euler (f ,[0 ,5] , -2 ,50); % solve the ODE using Euler w/ 50 steps
y50(end);
This code is literally provided by my teacher but it keeps saying Error in the line with the euler code. It is saying "Check for missing argument or incorrect argument data taype in call to function 'euler'.
0 件のコメント
回答 (2 件)
Ameer Hamza
2020 年 11 月 8 日
I think your teacher expects you to write euler() function yourself. MATLAB does not have a built-in function named euler() for solving ODEs. You can find the code of the Euler method here: https://www.mathworks.com/matlabcentral/answers/98293-is-there-a-fixed-step-ordinary-differential-equation-ode-solver-in-matlab-8-0-r2012b. Download the zip file and check the code for ode1.m
0 件のコメント
Alemtaye
2022 年 7 月 1 日
Write matlab code using euler method step size h=0.2,1,0.05.compute the error and relative error y'(t)=[cos(y(t))]^2,0<=t<=10,y(0)=0
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Numerical Integration and Differential Equations についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!