Effacer les filtres
Effacer les filtres

Antenna plot in 3D

5 vues (au cours des 30 derniers jours)
Tadej
Tadej le 20 Sep 2011
Can someone know what is wrong in my code? I adjust values (C,D,E,Ep,JpI) according the size [360x180] of matrices PHI and THETA. My task is to draw R (in may case this is array factor) in 3D space.
My code:
clear all;
close all
dbstop if error
V1=0; A1=0; C=0;
V2=0; A2=0; D=0;
V3=0; A3=0; E=0;
Ep=0; AnI=0; JpI=0;
R=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,...Nth element
Jp = [120 90 60]; %Phase of 1st, 2nd and 3rd,...Nth element
Xn = [1 2 3]; % Position of 1st, 2nd and 3rd,...Nth element on X-axis
Yn = [1 2 3]; % Position of 1st, 2nd and 3rd,...Nth element on Y-axis
Zn = [1 2 3]; % Position of 1st, 2nd and 3rd,...Nth element on Z-axis
%Azimut--> 0<Phi<360, Elevation--> 0<Theta<180
Phi = (1:1:360)*pi/180; %azimuth
Theta = (1:1:180)*pi/180; %elevation
[THETA,PHI] = meshgrid(Theta,Phi);
% calculate the array factor
%size(THETA)
%length(THETA)
%convert vector [1x3] into matrix [360x180] C = Xn .* sin(THETA) .* cos(PHI);
V1 = repmat(Xn,360,60);
A1 = sin(THETA) .* cos(PHI);
C = A1.*V1;
%convert vector [1x3] into matrix [360x180] D = Yn * sin(THETA) * sin(PHI);
V2 = repmat(Yn,360,60);
A2 = sin(THETA) .* sin(PHI);
D = A2.*V2;
%convert vector [1x3] into matrix [360x180] E = Zn * cos(THETA);
V3 = repmat(Zn,360,60);
A3 = cos(THETA);
E = A3.*V3;
Ep = B.*(C+D+E);
%convert degree into radian
Jp = (Jp.*pi)/180;
%sum velues in vector An, convert vector Jp [1x3] into matrix [360x180]
AnI = sum(An);
JpI = repmat(Jp,360,60);
R = AnI.*exp(1i.*(Ep + JpI)); %Equation for array factor
%h(PHI, THETA) = R;
%AF(PHI, THETA) = abs(h(PHI, THETA));
%plot the array factor
X = R.*sin(THETA).*cos(PHI);
Y = R.*sin(THETA).*sin(PHI);
Z = R.*cos(THETA);
figure();
mesh(X,Y,Z); %display
surf(X,Y,Z) %colored faces
title('Polar plot in 3D space')
xlabel('x-axis')
ylabel('y-axis')
zlabel('z-axis')
Best regards, Tadej

Réponse acceptée

Tadej
Tadej le 20 Sep 2011
I have found out. R has a complex values, so I just add R = abs®;
Greetings, Tadej

Plus de réponses (1)

Vishwanath Iyer
Vishwanath Iyer le 3 Juin 2021
Use the following documentation page and examples to learn about the use of arrayFactor in Antenna Toolbox

Catégories

En savoir plus sur Antennas, Microphones, and Sonar Transducers dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by