Plot 3D contours and surfaces with axes having the correct values?

I figured out how to plot a 2D (x,y) array full of Z values, but how do I get MATLAB to plot the x,y coordinates on their respective axes?

 Réponse acceptée

Kevin Holly
Kevin Holly le 20 Sep 2021
Modifié(e) : Kevin Holly le 20 Sep 2021
Are you trying to create a surf plot as shown below? where x and y are vectors of the coordinates.
%Generate Surf Plot
[xg, yg] = meshgrid(x,y);
surf(xg',yg',z)

Plus de réponses (1)

Mike Jones
Mike Jones le 21 Sep 2021
I did this plot in Excel from an ASCII file, showing the real values for the X and Y axis. I wrote the X axis values on the first line of the output file, then the rest of the lines show the Y-axis values and Z values. How do I do this in Excel?

1 commentaire

x = -15:1:15;
y = x
%Generate Surf Plot
[xg, yg] = meshgrid(x,y);
surf(xg',yg',z)
title('12.5" f/5 Windowed Newtonian - 2.6" Diagonal - 15x15mm FOV')
xlabel('X FOV (mm)')
ylabel('Y FOV (mm)')
view(0,90)
colorbar
colormap(jet)
%Generate Contour Filled
[xg, yg] = meshgrid(x,y);
contourf(xg',yg',z)
title('12.5" f/5 Windowed Newtonian - 2.6" Diagonal - 15x15mm FOV')
xlabel('X FOV (mm)')
ylabel('Y FOV (mm)')

Connectez-vous pour commenter.

Catégories

En savoir plus sur 2-D and 3-D Plots dans Centre d'aide et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by