P21_3 - Ea = abs((y25(i+1,1) - y25(i,1))/y25(i+1,1))*100; i...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
%Problem 21.3 % function P21_3 f y25true = 3.273888; y15 = 5.222138; y2 = 4.143883; y h = 0.5; h t = (2:h:2.5)'; y25(1,1) = y15 + dydt(2, y2)*2*h; y Et = 10; Es = 0.1; i = 1; while Et > Es y25(i+1,1) = y2 + (dydt(t(1,1), y2) + dydt(t(2,1), y25(i,1)))*(h/2); Et = abs((y25(i+1,1) - y25(i,1))/y25(i+1,1))*100
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Ea = abs((y25(i+1,1) - y25(i,1))/y25(i+1,1))*100; i = i+1; end e fprintf('After iterating the correction y(2.5) = %8.6f\n', y25(i,1)) Ea E function new1 = dydt(t, y) f new1 = -0.5*y + exp(-t);...
View Full Document

This note was uploaded on 09/21/2011 for the course EGM 3344 taught by Professor Raphaelhaftka during the Spring '09 term at University of Florida.

Ask a homework question - tutors are online