function x=gauss55(A,b)
m21=A(2,1)/A(1,1);
m31=A(3,1)/A(1,1);
m41=A(4,1)/A(1,1);
m51=A(5,1)/A(1,1);
A(2,:)=A(2,:)-m21*A(1,:);
A(3,:)=A(3,:)-m31*A(1,:);
A(4,:)=A(4,:)-m41*A(1,:);
A(5,:)=A(5,:)-m51*A(1,:);
b(2,1)=b(2,1)-m21*b(1,1);
b(3,1)=b(3,1)-m31*b(1,1);
b(4,1)=b(4,1)-m41*b(1,1);
b(5,1)=b(5,1)-m51*b(1,1);
m32=A(3,2)/A(2,2);
m42=A(4,2)/A(2,2);
m52=A(5,2)/A(2,2);
A(3,:)=A(3,:)-m32*A(2,:);
A(4,:)=A(4,:)-m42*A(2,:);
A(5,:)=A(5,:)-m52*A(2,:);
b(3,1)=b(3,1)-m32*b(2,1);
b(4,1)=b(4,1)-m42*b(2,1);
b(5,1)=b(5,1)-m52*b(2,1);
m43=A(4,3)/A(3,3);
m53=A(5,3)/A(3,3);
A(4,:)=A(4,:)-m43*A(3,:);
A(5,:)=A(5,:)-m53*A(3,:);
b(4,1)=b(4,1)-m43*b(3,1);
b(5,1)=b(5,1)-m53*b(3,1);
m54=A(5,4)/A(4,4);
A(5,:)=A(5,:)-m54*A(4,:);
b(5,1)=b(5,1)-m54*A(4,1);
x(5,1)=b(5,1)/A(5,5);
x(4,1)=(b(4,1)-A(4,5)*x(5,1))/A(4,4);
x(3,1)=(b(3,1)-A(3,4)*x(4,1)-A(3,5)*x(5,1))/A(3,3);
x(2,1)=(b(2,1)-A(2,3)*x(3,1)-A(2,4)*x(4,1)-A(2,5)*x(5,1))/A(2,2);
x(1,1)=(b(1,1)-A(1,2)*x(2,1)-A(1,3)*x(3,1)-A(1,4)*x(4,1)-A(1,5)*x(5,1))/A(1,1);
'이것저것 배운것 > 수업내용 - MATLAB' 카테고리의 다른 글
Gauss_Jordan 소거법 (0) | 2014.11.11 |
---|---|
Fr_bin2dec / Fr_dec2bin (0) | 2014.11.04 |
Gauss (0) | 2014.11.04 |
Gauss44 (0) | 2014.11.04 |
Gauss33 (0) | 2014.11.04 |