How to generating surface without plotting?
21 次查看(过去 30 天)
显示 更早的评论
I wonder if it's possible to create a surface by ''surf'' without plotting?
That means, I only want the surface data, but I don't want the figure.
Anyone has idea?
Thanks a lot and happy new year :)
2 个评论
采纳的回答
Ameer Hamza
2020-12-30
Since it is a graphical object, you cannot create it without plotting somewhere. However, you can make the figure invisible so that it does not appear on screen
[x, y, z] = ellipsoid(3,3,5,1,0.5,0.5)
f = figure('Visible', 'off');
ax = axes(f);
s = surf(ax,x,y,z)
direction = [rand() rand() rand()];
rotate(s,direction,rand()*360)
更多回答(1 个)
Cris LaPierre
2020-12-30
If I look at the first example on the surf documentation page, it first creates X, Y and Z, then uses surf to plot/create the surface. So is what you want X,Y and Z?
% Example modified to create surface data but not the surface
[X,Y] = meshgrid(1:0.5:10,1:20);
Z = sin(X) + cos(Y);
% surf(X,Y,Z)
另请参阅
类别
在 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!