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)
回答(1 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Introduction to Installation and Licensing 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!