Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- clear;
- f=@(x1,x2) [2*x1^2+x2^2-8;x1^2-x2^2+x1*x2-4];
- Delta=@(x1,x2) -([4*x1,2*x2;2*x1+x2,x1-2*x2]^(-1))*f(x1,x2);
- x=zeros(10,2);
- x(1,:)=[1,1];
- clc
- disp(['sol.: x1=' num2str(x(1,1)) ', x2=' num2str(x(1,2)) ' error left: ' num2str(norm(f(x(1,1),x(1,2))))]);
- for n=2:length(x)
- x(n,:)=x(n-1,:)+Delta(x(n-1,1),x(n-1,2))';
- disp(['sol.: x1=' num2str(x(n,1)) ', x2=' num2str(x(n,2)) ' error left: ' num2str(norm(f(x(n,1),x(n,2))))]);
- end
Advertisement
Add Comment
Please, Sign In to add comment