Monday 2 September 2013

Guass Jordan Augmented Method Code

a=[1,1,2;1,3,2;3,1,3;]
b=[9;13;14;]
au=horzcat(a,b)
i=0,j=0,l=0;
[m,n] = size(au)
for i=1:m
    for j=i:n-1
        if i==j && au(i,j) ~=0 && au(i,j)~=1      
         au(i,:)=au(i,:)/au(i,j)
          temp=au(i,:);
        else if i~=j
            au(j,:)=au(j,i)*au(i,:)-au(j,:)
            end
        end
    end
end
au
for k=1:m
    for l=1:n-1
        if l>k
            t=l-1;
            while t>=1
                au(t,:)=au(t,:)-au(t,l)*au(l,:)
                t=t-1;              
            end
        end
    end
end            

No comments:

Post a Comment