Hi! May I kindly ask for your help I have been working on Jacobi Method since yesterday and I haven’t figured it out yet I don’t have someone to ask. I would appreciate your help…
I wanted to show the results of my codes like this.....
example values only....
Iteration x1 x2 x3
1 3.00000 4.00000 4.60000
2 4.00000 4.60000 4.27076
3 4.60000 4.27076 4.30295
4 4.27076 4.30295 4.30697
5 4.30295 4.30697 4.30691
The roots are the following:
x1 = 1
x2 = 2
x3 =-1
Iteration = 9
Inputs are....
Enter the number of equations, n:
3
Enter absolute errror, Ea:
0.0001
Enter coefficient (Diagaonally Dominant), Matrix A:
[4 -1 -1;-2 6 1;-1 1 7]
Enter constants, Matrix B:
[3;9;-6]
Enter the initial guess, x0,x1,x2:
[0;0;0]
CODE
Eqn=input('Enter the number of equations, n: ');
Error=input('Enter absolute errror, Ea: ')
A=input('Enter coefficients (DIAGONALLY DOMINANT!), Matrix A: ');
B=input('Enter constants, Matrix B: ');
C=input('Enter the initial guess: x0,x1,x2: ');
x(i) = round((B(i)/A(i,i)) - (A(i,[1:i-1,i+1:N])*C([1:i-1,i+1:N]))/A(i,i),4);
fprintf('Iteration no %d \n',j)