简体   繁体   English

Matlab:网格和冲浪(3D图)

[英]Matlab: meshgrid and surf (3D plot)

I am trying to generate a 3D surface plot for x,y,z data using surf(): 我试图使用surf()为x,y,z数据生成3D表面图:

[x,y] = meshgrid(0.5:0.5:25, 0.5:0.5:45);
Z=(tand(y/2)*(1.84+x))*2;

but I get the following error: 但我收到以下错误:

Error using * Inner matrix dimensions must agree. 使用错误*内部矩阵尺寸必须一致。

Use the element-wise product: 使用按元素乘积:

Z=(tand(y/2).*(1.84+x))*2;
surf(x,y,Z);

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

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