Fri 06 Oct 2017 11:46:04 AM UTC, original submission:
ERROR: contourf(x,y,f) plots without error an array f which is smaller in at least 1 dimension than the length of the coordinate vectors x and y.
IMPACT: This results in unexpected behavior, because it is not obvious whether the function will pad the plot with white space, pad the array with zeros, or truncate the excessive x or y vector. It also is not obvious whether the function will align the array with the first or last values of the excessive x or y vector. The lack of precise input checking also allows dimension mismatch issues to persist, and makes overall debugging more difficult.
MINIMAL EXAMPLE: This code should, but does not, throw an error citing dimension mismatch between the array A and one or more of the coordinate vectors x and y:
clc, clear all, close all
A = zeros(100,99);
for j = 1:100, for k = 1:99, A(j,k) = j + 2*k; end, end
x = (1:100)';
y = (1:100)';
contourf(y,x,A), colorbar, xlabel('x'), ylabel('y')
|