Info
Diese Frage ist geschlossen. Öffnen Sie sie erneut, um sie zu bearbeiten oder zu beantworten.
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 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
%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 Kommentare
Antworten (0)
Diese Frage ist geschlossen.
Siehe auch
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!