CLC Clear: Gauss Elimination Code
CLC Clear: Gauss Elimination Code
end
for i=1+U:m-1
L=A(i+1,j)/A(j,j);
A(i+1,:)=A(i+1,:)-L*A(j,:);
r(i+1)=r(i+1)-L*r(j);
end
U=U+1;
end
%------------------------------------------------------
-----------
%Solution of equations
x(m)=r(m)/A(m,m);
for i=m-1:-1:1
sum=0;
for j=i+1:m
sum=sum+A(i,j)*x(j);
end
x(i)=(1/A(i,i))*(r(i)-sum)
end
x=
0 -3.2973 1.2973
x=
Numerical Methods
HOMWORK (2)