Not enough Input arguments (Adaptive RK method )
情報
この質問は閉じられています。 編集または回答するには再度開いてください。
古いコメントを表示
The photo attached is the question. Here is my script answer but error shows me that it has not enough input arguments in line 15. Can someone help me to fix this?
function[t,y]= P3(dydt,tspan,y0,h)
tspan=[0 4];
y0=0.5;
h=0.1;
ti=tspan(1);
tf=tspan(2);
t=(ti:h:tf)';
n=length(t);
if t(n)<tf;
n=n+1;
end
y=y0*ones(n,1);
for i=1:n-1
hh=t(i+1)-t(i);
k1= feval(dydt,t(i),y(i));
ymid=y(i)+k1*hh/2;
k2=feval(dydt,t(i)+hh/2,ymid);
y(i+1)=y(i)+k2*hh;
end
plot(t,y)
end
Not enough input arguments.
Error in P3 (line 15)
k1= feval(dydt,t(i),y(i));
1 件のコメント
Stephen23
2019 年 11 月 28 日
回答 (0 件)
この質問は閉じられています。
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!