Hi
I'm Dr. Antony Kishore. I was teaching Numerical methods using MATLAB in Loyola College, Chennai for more than 3 years. I can give you a sample of program written by me. If you are interested, please contact me.
Have a nice day.
Gauss Siedal Iteration method:
A=[5 -2 3;-3 9 1;2 -1 -7];b=[-1;2;3]
aug=[A b];
n=size(A,1);
x=zeros(1,n);
fprintf(' iter x1 x2 x3 error Percent \n');
iter=0;
while(1)
iter=iter+1;
xold=x;
for i=1:n
x(i)=aug(i,n+1);
for j=1:n
if j~=i
x(i)=x(i)-aug(i,j)*x(j);
end
end
x(i)=x(i)/aug(i,i);
end
ea=abs((x-xold)./x)*100;
fprintf('%4d %10.5f %10.5f %10.5f %10.5f %10.5f %10.5f \n',iter,x(1),x(2),x(3),ea(1),ea(2),ea(3));
if ea<0.05,break,end
end
soln=x