我只想将一个表面和一个点绘制成一个图形。但不幸的是,它没有奏效。另外,我想保留我指定的轴限制。
感谢您的帮助!
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;
答案 0 :(得分:0)
只需使用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;