Info
此问题已关闭。 请重新打开它进行编辑或回答。
any one help me ; how can I insert an array I=[600 400 200 100 0] in my code which solved using runge kutta method (this constant(I) change in my equations)
1 次查看(过去 30 天)
显示 更早的评论
%initial condition t(1)=0; Tg(1)=26;
%step size h=1; tfinal=300; N=ceil(tfinal/h);
%update loop for i=1:N %update time t(i+1)=t(i) + h; %update runge kutta loop k1Tg=fTg(t(i) ,Tg(i) ); k2Tg=fTg(t(i)+h/2,Tg(i)+h/2*k1Tg); k3Tg=fTg(t(i)+h/2,Tg(i)+h/2*k2Tg); k4Tg=fTg(t(i)+h ,Tg(i)+h *k3Tg);
Tg(i+1)=Tg(i)+ h/6*(k1Tg + 2*k2Tg + 2*k3Tg + k4Tg);
end
0 个评论
回答(0 个)
此问题已关闭。
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!