blob: 25d671f2a37f5334ec8814163096b969fff5ba52 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
//Eg-4.13
//pg-173
clear
clc
clc;
clear;
x0=0.5;
x1=0.5;
x2=0.5;
for i=1:6
Xold=[x0;x1;x2];
A=[2*cos(x0)*(sin(x0)-1)+2*sin(x0)*(cos(x1)-cos(x0)) 2*cos(x1)*(sin(x1)-1)+2*sin(x1)*(cos(x0)-cos(x1)) -2*(x2+0.25);cos(x0)*(x2+.25)+2*x2*(cos(x1)*cos(x0)+sin(x0)) -2*x2*sin(x0)*sin(x1) sin(x0)+2*(cos(x1)*sin(x0)-cos(x0));-2*x2*sin(x0)*sin(x1) (x2+.25)*cos(x1)+2*x2*(cos(x0)*cos(x1)+1.5*sin(x1)) sin(x1)+2*(sin(x1)*cos(x0)-1.5*cos(x1)) ];
b=-[(1-sin(x0))^2+(1.5-sin(x1))^2+(cos(x0)-cos(x1))^2-(x2+0.25)^2;(x2+0.25)*sin(x0)+2*x2*(cos(x1)*sin(x0)-cos(x0));(x2+0.25)*sin(x1)+2*x2*(cos(x0)*sin(x1)-1.5*cos(x1))];
Xnew=Xold+inv(A)*b;
x0=Xnew(1);
x1=Xnew(2);
x2=Xnew(3);
end
disp(Xnew)
|