13 w = 0.1*z;
14 w plot(z) = w;
15 fprintf(‘\n*****************************************\n’)
16 fprintf(‘\n\n Starting calculation for w = %3.1f \n’,w)
17 k = 0;
28 end
29 r = (b(i) – s)/A(i,i);
30 x(i) = x(i) + w*r;
31 end
32 err = norm(A*x-b);
43 plot(w plot,n iter,‘-ok’)
44 xlabel(‘Relaxation parameter, $w$’,‘FontSize’,14),
45 ylabel(‘Solution to s12c4p3’,‘FontSize’,14)
46 saveas(h,‘s12c4p3 solution figure.eps’,‘psc2’)
The output file is:
0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 2
0
20
40
60
80
100
120
140
160
180
Re lax ation parame t er, w
Solution t o s12c4p3