Question: function [x, A, b] = gauss(A,b) % this function will take in a matrix A and vector B and output % a solution fprintf(Converting A
function [x, A, b] = gauss(A,b) % this function will take in a matrix A and vector B and output % a solution fprintf("Converting A to upper triangular: ") n = size(A); % get number of equations x = zeros(n,1); % allocate memory % Triangulate the A matrix for j= 1:n-1 % loop through each column that has elements below diagonal for i= j+1:n % transform all elements below diagonal to 0 % i is dependent on j s = -A(i,j)/A(j,j); % calculate multiplier A(i,:) = A(i,:) + s*A(j, :); % apply ERO to the row of A b(i)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
