MATLAB: How to create contour

contour

Hello; Can anyone help me create contour map for attached file? Thank you,
Best, Muhsin A

Best Answer

"the data belongs to only three different randomly selected rows of the color cross section"
That was the missing bit of information. The values that you have been calling "Y" are really the result of measurements along lines, with the measurements not equally spaced, and one of the coordinates of the line given only implicitly, constants for any given "X" "Y" pair.
In the below code, I make the constant information into the x values, and assume the first pair is at x = 1, the second at x = 2, the third at x = 3. I then created scattered interpolants and sample them along a grid and contour the result.
num = csvread('contour.csv', 2);
N = ones(size(num,1),1);
D = [N, num(:,1), num(:,2); 2*N, num(:,4), num(:,5); 3*N, num(:,7), num(:,8)];
F = TriScatteredInterp(D(:,1),D(:,2),D(:,3));
[X,Y] = ndgrid(linspace(0,5,20),linspace(min(D(:,2)),max(D(:,2)),20));
Z = F(X,Y);
contour(X,Y,Z);