MATLAB爱好者论坛-LabFans.com

MATLAB爱好者论坛-LabFans.com (https://www.labfans.com/bbs/index.php)
-   MATLAB论坛 (https://www.labfans.com/bbs/forumdisplay.php?f=6)
-   -   [MATLAB基础] 如何用matlab画3维数据文件? (https://www.labfans.com/bbs/showthread.php?t=10219)

adameye 2009-11-18 06:12

如何用matlab画3维数据文件?
 
真是奇怪,我在网上找个例子:
[url]http://sc.tamu.edu/shortcourses/SC-matlab/visual/matlab-9.html[/url]
>> load out.dat;
>> x=out(:,1);
>> y=out(:,2);
>> [X Y]=meshgrid(x,y);
>> Z=out(:,3:size(out,2));
>> mesh(X,Y,Z);
但是为啥matlab总是提示我
??? Error using ==> mesh at 69
Z must be a matrix, not a scalar or vector.

Error in ==> test1 at 6
mesh(X,Y,Z);

搞不懂,文件很简单呀,比如:
2 4 5
2 3 4
4 7 8
...
文件有3列,代表x,y,z空间坐标

谢谢

adameye 2009-11-18 07:42

回复: 如何用matlab画3维数据文件?
 
scatter3 这个命令倒是可以画点,但是如何画出表面出来?
可能还是要用meshgrid?

wt_v90 2009-11-22 18:24

回复: 如何用matlab画3维数据文件?
 
z必须是一个矩阵,否则图形无法闭合。你给出的x,y,z只能在立体空间确定3个点,如果单纯只是想画3维图形点,可以用plot3。


所有时间均为北京时间。现在的时间是 13:52

Powered by vBulletin
版权所有 ©2000 - 2025,Jelsoft Enterprises Ltd.