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?

 Accepted Answer

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)

More Answers (1)

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 Comment

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)')

Sign in to comment.

Categories

Find more on 2-D and 3-D Plots in Help Center and File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!