# Untitled

By: Shootnigga on May 13th, 2012  |  syntax: MatLab  |  size: 0.77 KB  |  hits: 19  |  expires: Never
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
1. %Лабораторная работа №8. Задание 2.
2. % tan(xy)=x^2;
3. % 0.8x^2+2y^2=1;
4. X = [   0, 0.7,     0, -0.7;
5.      0.75, 0.7, -0.75, -0.7];
6. xx=-1.8:0.05:1.8;
7. yy=-1.8:0.05:1.8;
8. [x,y] = meshgrid(xx,yy);
9. f1 = tan(x*y)-x.^2;
10. f2 = 0.8*x.^2+2*y.^2-1;
11. it=[0,0,0,0];
12. contour(xx,yy,f1,[0,0], 'r'),
13. contour(xx,yy,f2,[0,0], 'k'), grid
14. for i=1:4
15.     delta = 1;
16.     while ( abs(delta) > 0.0001)
17.         delta = -[ X(2,i)*cos(X(1,i)*X(2,i)).^(-2)-2*X(1,i),...
18.                    X(1,i)*cos(X(1,i)*X(2,i)).^(-2);...
19.                    1.6*X(1,i),...
20.                    4*X(2,i)]\[tan(X(1,i)*X(2,i))-X(1,i).^2;...
21.                    0.8*X(1,i).^2+2*X(2,i).^2-1 ];
22.         Xn = X(1:2,i) + delta;
23.         X(1:2,i) = Xn;
24.         it(i)=it(i)+1;
25.     end
26. end
27. X,it