Anda di halaman 1dari 1

Exercise 2.

1
Question 6
//exercise2.1
//numbersixsixsix
//function[y]=jacobi(x0)
x0=[0,1,0];
x1=x0(1);
x2=x0(2);
x3=x0(3);
//y=[];
mprintf('%8.5s%8.5s%8.5s\n','x1','x2','x3');
n=15;
for i=1:n
x1=(1+x2-x3)/5;
x2=(-1-x1)/2;
x3=(2-(2*x1)-x2)/4;4
x=[x1;x2;x3];
//y=[y,x];
mprintf('%8.5f%8.5f%8.5f\n',x1,x2,x3);
end
//endfunction

Iteration
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15

x1
0.40000
-0.03500
-0.02412
-0.02440
-0.02439
-0.02439
-0.02439
-0.02439
-0.02439
-0.02439
-0.02439
-0.02439
-0.02439
-0.02439
-0.02439

x2
-0.70000
-0.48250
-0.48794
-0.48780
-0.48780
-0.48780
-0.48780
-0.48780
-0.48780
-0.48780
-0.48780
-0.48780
-0.48780
-0.48780
-0.48780

Yes, by using scilab we get the solution converged at 5 th iteration

x3
0.47500
0.63812
0.63405
0.63415
0.63415
0.63415
0.63415
0.63415
0.63415
0.63415
0.63415
0.63415
0.63415
0.63415
0.63415

Anda mungkin juga menyukai