# P12_7 - Err1(i,1) = abs(((x(i-1,1) - x(i,1))/x(i,1))*100);...

This preview shows pages 1–2. Sign up to view the full content.

%Problem 12.7 % function P12_7 f x = zeros(5,1); x y = zeros(5,1); y f1 = zeros(5,1); f f2 = zeros(5,1); f x(1,1) = 1.2; x y(1,1) = 1.2; y Err1 = zeros(5,1); E Err2 = zeros(5,1); E D = zeros(5,1); D Err1(1,1) = 10; E Err2(1,1) = 10; E i = 2; i Ea = 0.0000001; E D(i,1) = df1x(x(i-1,1), y(i-1,1))*df2y(x(i-1,1), y(i-1,1)) - df1y(x(i-1,1), y(i-1,1))*df2x(x(i-1,1), y(i-1,1)); y f1(i,1) = fun1(x(i-1,1), y(i-1,1)); f2(i,1) = fun2(x(i-1,1), y(i-1,1)); x(i,1) = x(i-1,1) - (f1(i,1)*df2y(x(i-1,1), y(i-1,1))-f2(i,1)*df1y(x(i-1,1), y(i-1,1)))/D(i,1); y(i,1) = y(i-1,1) - (f2(i,1)*df1x(x(i-1,1), y(i-1,1))-f1(i,1)*df2x(x(i-1,1), y(i-1,1)))/D(i,1); if i == 1 else

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Err1(i,1) = abs(((x(i-1,1) - x(i,1))/x(i,1))*100); Err2(i,1) = abs(((y(i-1,1) - y(i,1))/y(i,1))*100); end i = i+1; end e i = (0:5)'; i fprintf('Iteration x y Ea1 Ea2\n') for r =(1:5) f fprintf(' %1d %7.5f %8.6f %5.3f %7.3f\n', i(r,1), x(r,1), y(r,1), Err1(r,1), Err2(r,1)) y end e end function new1 = df1x(x, y) f new1 = 2*x-1; n end e function new2 = df1y(x, y) f new2 = 1; n end e function new3 = df2x(x, y) f new3 = -2*x + 5*y; n end e function new4 = df2y(x, y) f new4 = 1 + 5*x; n end e function new5 = fun1(x, y) f new5 = y + x^2 - x -0.5; n end e function new6 = fun2(x, y) f new6 = y - x^2 + 5*x*y; n end...
View Full Document

## P12_7 - Err1(i,1) = abs(((x(i-1,1) - x(i,1))/x(i,1))*100);...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online