Plot a Mesh or Surf plot for data points without a function
2 次查看(过去 30 天)
显示 更早的评论
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 个评论
Adam Danz
2020-7-30
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.
回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Surface and Mesh Plots 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!