Thread Subject: Error :"In an assignment A(I) = B, the number of elements in B and I must be the same."
显示 更早的评论
I have a problem with calculating Ep(I). Any suggestion how to sole this problem?
clear all;
% element numbers N, wavenumber B
N = input ('Enter the Number of Array Elements : ') ;
lambda = input ('Enter the Value of Lambda (c/f) : ') ;
B =(2*pi/lambda);
% Magnitude, Phase, X,Y,Z coordinate
for I = 1 : N
Current = I
An(I) = input ('Enter the Magnitude of the Current : ') ;
Jp(I) = input ('Enter the Phase of the Current : ') ;
Xn(I) = input ('Enter the Position of Element on X-axis : ') ;
Yn(I) = input ('Enter the Position of Element on Y-axis : ') ;
Zn(I) = input ('Enter the Position of Element on Z-axis : ') ;
end
%azimut--> 0<Phi<360, elevation--> 0<Theta<180
Phhi = (0:1:360)*2*pi/180;
Thheta = (0:1:180)*2*pi/180;
[PHI,THETA] = meshgrid(Phhi,Thheta);
%R=[];
% calculate the array factor
for I = 1:N
Ep(I)= B.*((Xn(I).*cos(PHI).*sin(THETA))+(Yn(I).*sin(THETA).*sin(PHI))+(Zn(I).*cos(THETA)));
R(I)= An(I).*exp(1i.*(Ep(I)+(Jp(I).*pi/180)));
end
h(THETA,PHI) = sum(R);
AF(THETA,PHI) = abs(h(THETA,PHI));
%plot the array factor
X = AF.*sin(THETA).*cos(PHI);
Y = AF.*sin(THETA).*sin(PHI);
Z = AF.*cos(THETA);
figure(2);
mesh(X,Y,Z); %display
%surf(X,Y,Z) %colored faces
Best regards, Tadej
2 个评论
Walter Roberson
2011-9-12
See also this earlier question on the same topic:
http://www.mathworks.com/matlabcentral/answers/14772-antenna-array-pattern-in-3d-space
Tadej
2011-9-12
采纳的回答
更多回答(1 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Array Geometries and Analysis 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!