[英]Plot single 3D point and surface into one figure
我只想将一个表面和一个点绘制成一个图形。 不幸的是,它没有工作。 另外,我想保留我指定的轴限制。
感谢您的任何帮助!
mldmnn
%% Create Observer Grid
[obsX obsY] = meshgrid(0:1:50); % Generate X and Y data of the observer positions
obsZ = zeros(size(obsX, 1)); % Generate Z data of the observer positions (always with obsZ = 0)
obsPos = [obsX(:), obsY(:), obsZ(:)]; % List every observer position
%% Read Source Position
% Dummy source position
srcX = 10;
srcY= 10;
srcZ = 25;
srcPos = [srcX srcY srcZ];
%% For the Sake of Visualisation: Plot Observer Plane and Source Position
surf (obsX, obsY, obsZ);
plot3(srcX, srcY, srcZ,'.r','MarkerSize', 30);
xlim([0 50]);
ylim([0 srcY+15]);
zlim([0 50]);
grid on;
只需使用hold on
方法将图保留在当前轴上,这样添加到轴上的新图就不会删除现有图。 因此,您需要对代码段进行一些修改:
surf (obsX, obsY, obsZ);
hold on;
plot3(srcX, srcY, srcZ,'.r','MarkerSize', 30);
xlim([0 50]);
ylim([0 srcY+15]);
zlim([0 50]);
grid on;
hold off;
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.