hw11_p06newton - f2 = f(xold,yold-h, CA0, CB0, CC0, CD0,...

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

View Full Document Right Arrow Icon
function [xnew, ynew] = hw11_p06newton( xold, yold, CA0, CB0, CC0, CD0, K1, K2 ) A(1,1) = fx(xold, yold, CA0, CB0, CC0, CD0, K1, K2); A(1,2) = fy(xold, yold, CA0, CB0, CC0, CD0, K1, K2); A(2,1) = gx(xold, yold, CA0, CB0, CC0, CD0, K1, K2); A(2,2) = gy(xold, yold, CA0, CB0, CC0, CD0, K1, K2); A b(1,1) = -f(xold, yold, CA0, CB0, CC0, CD0, K1, K2); b(2,1) = -g(xold, yold, CA0, CB0, CC0, CD0, K1, K2); b delta = A\b; d xnew = xold + delta(1,1); ynew = yold + delta(2,1); y function f_x = fx( xold, yold, CA0, CB0, CC0, CD0, K1, K2 ) h = .000001; f1 = f(xold+h,yold, CA0, CB0, CC0, CD0, K1, K2); f2 = f(xold-h,yold, CA0, CB0, CC0, CD0, K1, K2); f f_x = (f1-f2)/(2*h); f function f_y = fy( xold, yold, CA0, CB0, CC0, CD0, K1, K2 ) h = .000001; f1 = f(xold,yold+h, CA0, CB0, CC0, CD0, K1, K2);
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: f2 = f(xold,yold-h, CA0, CB0, CC0, CD0, K1, K2); f f_y = (f1-f2)/(2*h); f function g_x = gx( xold, yold, CA0, CB0, CC0, CD0, K1, K2 ) h = .000001; g1 = g(xold+h,yold, CA0, CB0, CC0, CD0, K1, K2); g2 = g(xold-h,yold, CA0, CB0, CC0, CD0, K1, K2); g g_x = (g1-g2)/(2*h); g function g_y = gy( xold, yold, CA0, CB0, CC0, CD0, K1, K2 ) h = .000001; g1 = g(xold,yold+h, CA0, CB0, CC0, CD0, K1, K2); g2 = g(xold,yold-h, CA0, CB0, CC0, CD0, K1, K2); g g_y = (g1-g2)/(2*h); g function f_ = f( xold, yold, CA0, CB0, CC0, CD0, K1, K2 ) f_ = K1*(CA0-2*xold-yold)^2*(CB0-xold) - (CC0 +xold + yold); f function g_ = g( xold, yold, CA0, CB0, CC0, CD0, K1, K2 ) g_ = K2*(CA0-2*xold-yold)*(CD0-yold) - (CC0 +xold + yold);...
View Full Document

This note was uploaded on 02/22/2010 for the course CHE 348 taught by Professor Chelikowsky during the Spring '08 term at University of Texas at Austin.

Ask a homework question - tutors are online