Heun's Method program code

%%%% I can't figure out why my function 'HeunIter' doesnot work; even cannot try it! >>>>>>>>>>>>>> function HeunIter(x, y, h, ynew)
es=0.01;
maxit=20;
Call Derivs(x, y, dy1dx);
ye=y+dy1dx*h;
iter=0;
while (ea>es or iter<=maxit)
yeold=ye;
call Derivs(x+h,ye,dy2dx);
slope=(dy1dx+dy2dx)/2;
ye=y+slope*y;
iter=iter+1;
ea=abs((ye-yeold)/ye)*100;
end
ynew=ye
x=x+h
end
%%%% Below is when i try to run function.
>> HeunIter(0,4800,1,2) 'HeunIter'은(는) 정의되지 않은 함수 또는 변수입니다. %%%% It means 'HeunIter' is undefined function or variable. (In korean)

Answers (1)

Hojin Jung
Hojin Jung on 8 Jun 2018
I also have another function above :
function Derivs(x, y, deriv) deriv=4800-0.6*y/(1-0.025*x); end

Categories

Tags

Asked:

on 8 Jun 2018

Answered:

on 8 Jun 2018

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!