Antenna array pattern in 3D space
이전 댓글 표시
Hy guys. Can please someone help me. When I start the program I have an error: Error: Unexpected MATLAB operator.
%Tadej Trinko; three-dimensional antenna array pattern
%email:tadej.trinko@gmail.com
%Jožef Štefan International Postgraduate School (MPS IJS), Ljubljana,
%Slovenia
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);
j = sqrt(-1);
% Magnitude, Phase, X,Y,Z coordinate
for I = 1 : N
Current = I
An(I) = input ('Enter the Magnitude 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 : ') ;
Jp(I) = input ('Enter the Phase of the Current : ') ;
end
Phi=(0:1:360)*pi/180;
Theta=(0:1:180)*pi/180;
[THETA,PHI]=meshgrid(Theta,Phi);
% calculate the array factor
for I=1:N
R=An(I)*exp(1j.*(Ep+Jp(I)));
Ep=B*((Xn(I).*cos(PHI).*sin(THETA))+(Yn(I).*sin(THETA).*sin(PHI))+(Zn(I).*cos(THETA)));
end
%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
Equation (1) on page 4 in article: http://www.loe.ee.upatras.gr/EM/Journals/Array%20Factor%20Measurements%20A%20Preliminary%20Stage%20in%20a%20Methodology%20for%20Smart%20Antenna%20Characterization%20Measurements.pdf
Thank you for any advice or comment.
Regards, Tadej
채택된 답변
추가 답변 (1개)
Walter Roberson
2011년 8월 30일
1 개 추천
Which line does it complain about, and which column?:
I am not sure that 1j can be used to mean 1 times the imaginary unit. I know 1i can be used. As you defined j as sqrt(-1) it would seem to be more consistent for you to use 1*j in that location.
Your second "for" loop, the one with the comment "calculate the array factor", does not store its results, and does not use the results in further computation. That is going to cause R and Ep to be overwritten during each iteration of the loop, and so will contain only a single value at the end of the loop.
I would suggest that you want R(I)= ... and Ep(I) = ... but the Ep expression appears to have a vector result, so at the very least it would have to be Ep(I,:) or Ep(:,I). I also see that If you were to use R(I) then R would end up of length N, but R is then .* by trig array values that are 361 x 181 so multiplying by a vector R of length N is problematic.
Your code appears to be incomplete and incorrect.
댓글 수: 9
Walter Roberson
2011년 8월 30일
Ah, I just noticed your second "for" loop does use Ep in defining R. But it does that before Ep has been defined at all.
Tadej
2011년 8월 30일
Tadej
2011년 8월 30일
Walter Roberson
2011년 8월 30일
Did you try to store this in a file named 3Darray_2.m ? Filenames for scripts have to follow the same rules as filenames for functions, which in turn have to follow the same rules as the names of identifiers: the first character must be an upper or lower case English ('Latin') letter, and the characters after that can be upper or lower case English letters or the English digits 0 through 9 or the character underscore ('_')
Tadej
2011년 8월 31일
Tadej
2011년 8월 31일
Walter Roberson
2011년 8월 31일
Please re-read the "I would suggest that you want" section of my response...
Tadej
2011년 9월 9일
Tadej
2011년 9월 9일
카테고리
도움말 센터 및 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!