%% Turn Off Matrix Condition Warnings
% Use the 'CheckCondition' name-value pair to turn off warnings based on the condition of the coefficient matrix when solving a linear system using decomposition.
%
% Create a coefficient matrix that is ill conditioned. In this matrix, averaging together the first two columns produces the third column.

A = [1 2 1.5; 3 4 3.5; 5 6 5.5]

%
% Solve a linear system \textrm{Ax}=b using a vector of 1s for the right-hand side. mldivide produces a warning about the conditioning of the coefficient matrix.

b = ones(3,1);
x = A\b

%
% Now create a decomposition object for the matrix and solve the same linear system. Specify 'CheckCondition' as false so that mldivide does not check the condition of the coefficient matrix. Even though the same solution is returned, mldivide does not display the warning message.

dA = decomposition(A,'CheckCondition',false);
x = dA\b

%
% Use the isIllConditioned function to check whether the decomposition object is based on an ill-conditioned matrix.

tf = isIllConditioned(dA)

% Copyright 2012 The MathWorks, Inc.