3D plot of antenna factor
4 次查看(过去 30 天)
显示 更早的评论
Can please someone halp me to draw a 3D plot. It should be something like: plot(THETA, PHI, AFlog); I know that I should have used a masgrid function, but I allways do it wrong. And I do not know why am I doing wrong.
clear all;
close all
dbstop if error
C=0; D=0; E=0;
Ep=0; AnI=0; JpI=0; R=0; Rn=0;
% number of elements N, wavenumber B
N = 3; %Number of elemnts in array
B = 0.14; %B =(2*pi/lambda), wavenumber
% Magnitude, Phase, X,Y,Z coordinate
An = [2 2 2]; %Magnitude of 1st, 2nd and 3rd element
Jp = [120 90 60]; %Phase of 1st, 2nd and 3rd element
Xn = [1 2 3]; % Position of 1st, 2nd and 3rd element on X-axis
Yn = [1 2 3]; % Position of 1st, 2nd and 3rd element on Y-axis
Zn = [1 2 3]; % Position of 1st, 2nd and 3rd element on Z-axis
THETA = (120*pi)/180; %120 degree of theta angle
PHI = (330*pi)/180; %330 degree of phi angle
% calculate the array factor
C = Xn.*sin(THETA).*cos(PHI);
D = Yn.*sin(THETA).*sin(PHI);
E = Zn.*cos(THETA);
Ep = B.*(C + D + E);
%convert degree into radian
JpI = (Jp.*pi)/180;
Rn = An.*exp(1i.*(Ep + JpI)); %Equation for array factor
R = sum(Rn);
AF = abs(R);
AFlog = 10 .* log (AF);
%azimut--> 0<Phi<360, elevation--> 0<Theta<180
Phi = (1:10:360)*pi/180; %azimuth
Theta = (1:10:180)*pi/180; %elevation
[THETA,PHI] = meshgrid(Theta,Phi);
%plot the array factor
figure();
mesh(THETA,PHI,AFlog); %display
surf((THETA,PHI,AFlog) %colored faces
title('Polar plot in 3D space')
xlabel('x-axis')
ylabel('y-axis')
zlabel('z-axis')
Best regards, Tadej
0 个评论
回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Analysis, Benchmarking, and Verification 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!