Error using Euler Method
7 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
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 comentarios
Respuestas (2)
Ameer Hamza
el 8 de Nov. de 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 comentarios
Alemtaye
el 1 de Jul. de 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 comentarios
Ver también
Categorías
Más información sobre Numerical Integration and 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!