>> x=[0 0 4;0 1 4;0 2 4;1 0 8;1 1 8;1 2 8;2 0 12;2 1 12;2 2 12;3 0 16;3 1 16;3 2 16] % 图像宽w=4,h=3 即x=0:3,y=0:2 x1=reshape(x(:,1),3,4) y1=reshape(x(:,2),3,4) z1=reshape(x(:,3),3,4) x = 0 0 4 0 1 4 0 2 4 1 0 8 1 1 8 1 2 8 2 0 12 2 1 12 2 2 12 3 0 16 3 1 16 3 2 16 x1 = 0 1 2 3 0 1 2 3 0 1 2 3 y1 = 0 0 0 0 1 1 1 1 2 2 2 2 z1 = 4 8 12 16 4 8 12 16 4 8 12 16 mesh(x1,y1,z1) >>
换成另一种方式生成x,y坐标矩阵,结果和上面相同 >> [x,y]=meshgrid(0:3,0:2) x = 0 1 2 3 0 1 2 3 0 1 2 3 y = 0 0 0 0 1 1 1 1 2 2 2 2 >> >>
matlab二维图片三维显示
最新推荐文章于 2022-04-21 07:35:18 发布