3-D plot in Matlab

6 ビュー (過去 30 日間)
Mike Lee
Mike Lee 2017 年 2 月 23 日
コメント済み: Chibuzo Nnonyelu 2018 年 1 月 27 日
Hi,
I have a set of data from my antenna measurement such as azimuth, elevation and amplitude.
Is there any feature in matlab that I can use to do 3-D plot with those three data?
Thanks
  3 件のコメント
Mike Lee
Mike Lee 2017 年 2 月 27 日
It is angle between Z-axis
Chibuzo Nnonyelu
Chibuzo Nnonyelu 2018 年 1 月 27 日
Ok. Sorry for late response. I had attached a function for that. The function produces a 3-D plot in the spherical Cartesian coordinates.

サインインしてコメントする。

回答 (1 件)

Chibuzo Nnonyelu
Chibuzo Nnonyelu 2017 年 2 月 23 日
You can modify this function to work for you:
function plotsphere(azimuth, elevation, amplitude)
[X, Y, Z] = sph2cart(azimuth, elevation, amplitude);
grid on;
plot3(X, Y, Z, 'MarkerSize', 6,'Color', 'b','Marker', '.',...
'LineStyle', 'none'); hold on;
set(gca, 'xlim',[-2 2], 'ylim', [-2 2], 'zlim', [-2 2], 'Fontsize', 16);
nA = max([max(abs(X)) max(abs(Y)) max(abs(Z))]);
view(178, 10);
aL = max(nA);
lOffset = 0.05;
aLimit = [-aL-lOffset aL+lOffset];
set(gca, 'xlim', aLimit, 'ylim', aLimit, 'zlim', aLimit, 'Fontsize', 16);
%drawing the axes's lines
line(aLimit,[0,0],[0, 0],'linewidth',4,'color',[0,0,0]); %x-axis
line([0,0],aLimit,[0, 0],'linewidth',4,'color',[0,0,0]); %y-axis
line([0,0],[0,0],aLimit,'linewidth',4,'color',[0,0,0]); %z-axis
%labeling the axes
text(aLimit(2) + 0.05, 0, 0,'x','fontsize',18,'horizontalalignment','center', 'Interpreter', 'latex');
text(0, aLimit(2) + 0.05, 0,'y','fontsize',18,'horizontalalignment','center', 'Interpreter', 'latex');
text(0, 0, aLimit(2) + 0.05,'z','fontsize',18,'horizontalalignment','center', 'Interpreter', 'latex');
grid on;
%suppressing original x, y, axis
set(gca, 'XTick',[], 'ZTick',[], 'YTick',[], 'XColor', 'w', 'YColor', 'w', 'ZColor', 'w');
axis square;
end

カテゴリ

Help Center および File ExchangeDesign, Analysis, Benchmarking, and Verification についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by