MATLAB: How to create a 3D contour Plot from X,Y,Z table

contourMATLABsurface

I have a table an X,Y,Z table extracted from STAR-CCM over the surface of an object. The X,Y,Z dat corresponds to Pressure, X -Position, and Z-Position. Each X,Z coordinate has a corresponding Pressure value.
How do I plot a surface plot of this?
Attached is the data I'm using.

Best Answer

Try this:
d = csvread('Cell Surface Pressure.csv');
p = d(:,1);
x = d(:,2);
z = d(:,3);
xv = linspace(min(x), max(x), 1000);
zv = linspace(min(z), max(z), 1000);
[X,Z] = meshgrid(xv, zv);
P = griddata(x, z, p, X, Z);
figure
scatter3(x, z, p, '.')
grid on
figure
meshc(X, Z, P)
grid on
figure
contourf(X, Z, P)
grid on
The first figure is a scatter plot of your original data,.the second a surface rendering with a contour, and the third, a filled contour plot.