This preview has intentionally blurred sections. Sign up to view the full version.
View Full DocumentThis preview has intentionally blurred sections. Sign up to view the full version.
View Full DocumentThis preview has intentionally blurred sections. Sign up to view the full version.
View Full DocumentThis preview has intentionally blurred sections. Sign up to view the full version.
View Full DocumentThis preview has intentionally blurred sections. Sign up to view the full version.
View Full DocumentThis preview has intentionally blurred sections. Sign up to view the full version.
View Full DocumentThis preview has intentionally blurred sections. Sign up to view the full version.
View Full DocumentThis preview has intentionally blurred sections. Sign up to view the full version.
View Full DocumentThis preview has intentionally blurred sections. Sign up to view the full version.
View Full Document
Unformatted text preview: %Let's define the right hand side vector b b=[5*c01; 0; 160; 0; 0]; [L,U]=lu(A); z = L\b; c = U\z %part 2 of the problem c01=1:20; for i=c01 b=[5*c01(i); 0; 160; 0; 0]; z = L\b; c = U\z; c2(i) = c(2); end plot(c01,c2);grid on 2 4 6 8 10 12 14 16 18 20 2 4 6 8 10 12 14 16 18 20 %problem 5  Newton's method clear all ; ITERMAX = 2; Tol = 1e4; % give the initial guess x = [0.75;0.75]; %note I use x(1)=x & x(2) = y iter = 0; while (1) xold = x; %define the Jacobian matrix & right hand side A = [1x(2) x(1);x(2) 1+x(1)]; b = [(x(1)x(1)*x(2)); (x(2) +x(1)*x(2))]; %solve the system delx = A\b; iter = iter + 1; disp([ 'Iter : ' num2str(iter)]); %new root x = xold + delx %RE re = abs((x  xold)./x); if ((max(re) < Tol)  (iter == ITERMAX)) break ; end end OUPUT: Iter : 1 x = 1.1250 1.1250 Iter : 2 x = 1.0125 1.0125...
View
Full Document
 Spring '07
 Milstein
 matlab, Input/output, Righthand rule

Click to edit the document details