Error using Euler Method
7 views (last 30 days)
Show older comments
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 Comments
Answers (2)
Ameer Hamza
on 8 Nov 2020
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 Comments
Alemtaye
on 1 Jul 2022
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 Comments
See Also
Categories
Find more on Numerical Integration and Differential Equations 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!