## I have data points for different x and y points in excel and am trying to create a 3D contour plot of this data

### Stephen Mixon (view profile)

on 17 Sep 2019
Latest activity Commented on by Star Strider

on 17 Sep 2019

### Star Strider (view profile)

For two different experiments I took data at various x and y coordinates in an excel spreedsheet. I need to plot this data into a 3d contour plot in MATLAB. I used [x,y] = meshgrid(2:0.5:26, 2:0.5:18) to establish my axis but I dont know how to plot each data point at the corresponding x and y value. Excel sheet is attached

#### 1 Comment

on 17 Sep 2019
Check out the examples in the documentation that use the same approach.

### Star Strider (view profile)

on 17 Sep 2019

I have absolutely no idea what you want.
Try this:
y1 = D(2:12, 2:end);
y2 = D(16:26, 2:end);
xv = D(1,2:end);
yv = D(2:12,1);
figure
mesh(xv, yv, y1)
hold on
contour3(xv, yv, y1, '-k', 'LineWidth',1.5)
hold off
grid on
figure
mesh(xv, yv, y2)
hold on
contour3(xv, yv, y2, '-k', 'LineWidth',1.5)
hold off
grid on
Experiment to get the result you want.

Stephen Mixon

### Stephen Mixon (view profile)

on 17 Sep 2019
I measured data points at different x and y values. I need to plot these data points on a contour plot at those x and y values.

on 17 Sep 2019
Star Strider

### Star Strider (view profile)

on 17 Sep 2019
@Stephen Mixon — My code provides the 3D contour plots you said you wanted.
For 2D contour plots, this works:
figure
contour(xv, yv, y1)
figure
contour(xv, yv, y2)
Also consider using the contourf function.