简体   繁体   English

如何在matlab中用三个一维数组绘制3d网格图

[英]How to plot 3d mesh graph with three 1 dimensional arrays in matlab

I want to make a 3d mesh graph in Matlab and I have three 1 dim arrays as following我想在 Matlab 中制作一个 3d 网格图,并且我有三个 1 dim 阵列,如下所示

x={1,2,3,4,5} y={6,7,8,9,10} z=(11,12,13,14,15} x={1,2,3,4,5} y={6,7,8,9,10} z=(11,12,13,14,15}

enter image description here在此处输入图片说明

I need matlab code for Mesh Graph.我需要网格图的 matlab 代码。

Note: I have found lot of material regarding Mesh Graphs and mostly using function or single values.注意:我发现了很多关于网格图的材料,并且主要使用函数或单个值。 I need it for three 1 dimensional arrays.我需要三个一维数组。

If x and y are the values in plane-direction, then you need to have a 2d- z -array, because otherwise your coodinates are not fully defined.如果xy是平面方向的值,那么您需要有一个 2d- z数组,否则您的坐标未完全定义。 Every point in the plane needs a corresponding z-value.平面中的每个点都需要相应的 z 值。 Therefore the following works:因此,以下工作:

x = [1 2 3]; y = [4 5 6]; z = [7 8 9; 10 11 12; 13 14 15];
mesh(x,y,z);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM