Trying to plot a 2D K vs Kh giving me the bellow error (Warning: Matrix is singular to working precision.) How do I solve this?

1 view (last 30 days)
rangePlot = -10 : 0.1 : 10 ;
[K, Kh] = meshgrid(rangePlot) ;
ineqOne = K > 0 ;
ineqTwo = Kh > ((K - 5)/(5 * K)) ; --> Warning: Matrix is singular to working precision.
ineqOne = double(ineqOne) ;
ineqTwo = double(ineqTwo) ;
output = ones(length(rangePlot)); % Initialize square matrix of ones
%output(~(ineqOne & ineqTwo)) = 0; % Zero out coordinates not meeting conditions.
imshow(output, 'xdata', rangePlot, 'ydata', rangePlot); % Display
axis ij;
axis on;

Answers (1)

Walter Roberson
Walter Roberson on 21 May 2022
In MATLAB the / operation is Matrix Right Division. A/B is approximately A*pinv(B) where * is algebraic matrix multiplication and pinv() is pseudo-inverse.
You probably need the ./ operation for element by element division

Categories

Find more on Function Creation in Help Center and File Exchange

Products


Release

R2022a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!