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
답변 (0개)
이 질문은 마감되었습니다.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!