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));
回答(0 个)
此问题已关闭。
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!