0% found this document useful (0 votes)
31 views1 page

Exercise 2.1 Question 6

This document contains code in the Scilab programming language that is solving a system of equations using the Jacobi iterative method. It initializes the variables x0, x1, x2, x3, then runs the Jacobi method for 15 iterations to calculate updated values for x1, x2, x3 in each step. The output shows the values converge after 5 iterations, as x1, x2, and x3 remain constant from iterations 5 onward.

Uploaded by

Khairul Amirul
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
31 views1 page

Exercise 2.1 Question 6

This document contains code in the Scilab programming language that is solving a system of equations using the Jacobi iterative method. It initializes the variables x0, x1, x2, x3, then runs the Jacobi method for 15 iterations to calculate updated values for x1, x2, x3 in each step. The output shows the values converge after 5 iterations, as x1, x2, and x3 remain constant from iterations 5 onward.

Uploaded by

Khairul Amirul
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 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

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy