Assignment4

advertisement
Assignment 4
Due date: Jan 12, 2016 (in class)
Dr. Ala’ Khalifeh
Note: no soft copies.
Write a Matlab code to solve the set of linear equations using Gauss Seidel method
Notice that you need to do the following:
-
Chose an initial point randomly using the below command
X_initial = 5*rand(3,1),
Using this initial point to do your iterations using Gauss Seidel method and use l2 norm <= .01 as
your stopping criteria.
You need to try out 10 different initial points, and for each initial point you need to find how
many iterations your code needed until it converge.
Deliverable:
No.
1
2
.
.
10
-
The Matlab code
A table like the following (the numbers inside the table are just examples):
Intimal point
X_initial= [1.2 2.2 4.5]
X_initial= [3.2 2.3 2.5]
l2 norm
.001
.005
Number of iterations
10
20
X_initial= [1 3.3 1.5]
.002
15
Note: you need to chose a loop to automatically chose the x_initial point and to find out the
number of iterations to converge.
Download