Answered You can hire a professional tutor to get the answer.

QUESTION

how to correct the function in this math lab programming to make it run?

how to correct the function in this math lab programming to make it run?function x = fpGauss(A,b,nD,opt)% Gaussian elimination with nD decimal digits in the mantissaclc;disp(strcat('System matrix, rhs with nD=',num2str(nD),' mantissa digits'))Ab = [fp(A,nD) fp(b,nD)]n = max(size(A));scale = opt(1);pivot = opt(2);if scale > 0 disp('Scaled system matrix:') Ab = fp(scalerows(Ab),nD) endfor k=1:n-1 disp(strcat('*** Stage k=',num2str(k))) if pivot > 0Pivoted system matrix:')Ab = pivotrows(Ab,k) end for i=k+1:nm = fp(Ab(i,k)/Ab(k,k),nD);Ab(i,k)=0;for j=k+1:n+1Ab(i,j) = fp( Ab(i,j) - fp(m*Ab(k,j),nD) , nD );end endAfter applying multipliers') Ab if scale > 1 Scaled system matrix:')Ab = fp(scalerows(Ab),nD) endendfor k=n:-1:1 x(k) = fp(Ab(k,n+1)/Ab(k,k),nD); for i=1:k-1Ab(i,n+1) = fp(Ab(i,n+1) - fp(Ab(i,k)*x(k),nD),nD); endenddisp(strcat('Solution with nD=',num2str(nD),' mantissa digits'))x

Show more
LEARN MORE EFFECTIVELY AND GET BETTER GRADES!
Ask a Question