MATLAB problem

xsnbiubiu
mysolve.txt

function [x,incompatible]=mysolve( A,b ) %MYSOLVE [x,incompatible]=mysolve( A,b ) % solves the full-rank system Ax = b. The matrix A need not % be square. If there is no x such that Ax = b, i.e., the % equations are incompatible, an error message is printed. incompatible = 0; [m,n] = size(A); x = []; if rank(A) ~= min(m,n) disp( [ ' mysolve: No can do: A must have full rank.' ] ); disp( [ ' ' ] ); elseif rank( [ A b ] ) == rank( A ) x = A\b; % See below for information on this command else disp( [ ' mysolve: The equations Ax = b are incompatible.' ] ); disp( [ ' ' ] ); if nargout > 1 % Test the number of output arguments specified incompatible = 1; end end