Error using Euler Method
7 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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 commentaires
Réponses (2)
Ameer Hamza
le 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 commentaires
Alemtaye
le 1 Juil 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 commentaires
Voir également
Catégories
En savoir plus sur Numerical Integration and Differential Equations dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!