I wrote the following matlab code :
function [w] = SOR( A, b, x)
%UNTITLED Summary of this function goes here
% Detailed explanation goes here
error=1;
while error <= 10^-8;
w(1,1)=x(1,1)+1.6399/A(1,1)*(b(1,1)-A(1,1)*x(1,1)-A(1,2)*x(1,2)-A(1,3)*x(1,3));
for i=2:8;
w(1,i)=x(1,i)+1.6399/A(i,i)*(b(1,i)-A(i,i-1)*w(1,i-1)-A(i,i)*x(1,i)-A(i,i+1)*x(1,i+1));
end
w(1,9)=x(1,9)+1.6399/A(9,9)*(b(1,9)-A(9,8)*w(1,8)-A(9,9)*x(1,9));
z(1,i)=w(1,i)-x(1,i);
for j=1:9;
sum3=sum3+z(1,j)*z(1,j);
end
for j=1:9;
sum4=sum4+w(1,j)*w(1,j);
end
norma1=sqrt(sum3);
norma2=sqrt(sum4);
error=norma1/norma2;
for i=1:9;
x(1,i)=w(1,i);
end
end
end
When I ran the code I received no output...what's wrong??
Thanks
|