%When I try to perform a row interchange for 'b' vector It tells me it exceeds the no of array elements. This is an attempt to perform partial pivoting for matrix A and vector b separately.
Thanks
A = [1 2 3;4 2 -1; 3 2 3];b = [1; 3; 2];k = 1;A = pivoting(A,k)function [A, b, flag] = pivoting(A, b, k)n = size(A,1);flag = 0; for k=1:n-1 [big, i]=max(abs(A(k:n,k))) ipr=i+k-1 if ipr~=k A([k,ipr],:)=A([ipr,k],:) b([k,ipr])=b([ipr,k]) endend end
Best Answer