Plot a Mesh or Surf plot for data points without a function

2 views (last 30 days)
I need to make a mesh plot/ surf plot for the following data
X = [1, 1.5, 2, 2.5, 3, 3.5, 4, 4.5, 5, 5.5];
Y = [1, 0.9, 0.8, 0.7, 0.6, 0.5, 0.4, 0.3, 0.2, 0.1];
Z = [103, 120, 156, 206, 256, 302, 342, 376, 448, 508];
How can I plot a 3D mesh/surf plot for this data wherein X and Y are giving rise to the data poins in Z?
Thank you.
  4 Comments
Adam Danz
Adam Danz on 30 Jul 2020
Forget about how to write code for a moment and think of this problem conceptually.
You've got 3 variables that define 10 points in a 3D space. When those 10 points are connected, it forms a line / curve which is what you see when you plot the variables with plot3.
It's unclear to us how those data can be extended to illustrate a surface. If Z were a matrix of size (numel(X), numel(Y)), then you could use meshgrid or ndgrid to expand the X and Y values in order to plot a surface.

Sign in to comment.

Answers (0)

Community Treasure Hunt

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

Start Hunting!