This preview shows page 1. Sign up to view the full content.
Unformatted text preview: h=(b-a)/N; t=a; t(1)=t; y=alpha; y(1,:) = y'; y(1) = alpha; t(1) = a; % the main loop for calculating the values of y. for i=1:N, f1 = h*feval(fofty,t,y); f2 = h*feval(fofty,t+h/2, y+f1/2); f3 = h*feval(fofty,t+h/2, y+f2/2); f4 = h*feval(fofty,t+h, y+f3); y = y+(f1+2*f2+2*f3+f4)/6; t = t+h; end t(i+1) = t; y(i+1,:)=y';...
View Full Document
This note was uploaded on 12/19/2010 for the course PHYS 5073 taught by Professor Mark during the Spring '10 term at Arkansas.
- Spring '10