How to calculate array factor in matlab

I m trying to write matlab code for this expression.
Can anyone help me with this?
Thanks!!!!

댓글 수: 11

Rik
Rik 2021년 12월 23일
What have you tried so far? This doesn't look like it should be too complicated to write.
Note that the subscripts are very hard to read in your image.
FARHA KHAN
FARHA KHAN 2021년 12월 23일
편집: Rik 2021년 12월 23일
I have tried this: Here there are two rings 1st ring 4ele and 2nd ring ring 16ele. subscripts for first summation:m=1:M (here M=1,2) subscripts for second summation:Nm (here Nm=4,16) i.e when m=1 Nm=4 and when m=2 Nm=16.
I hope you undersood this .
I am not getting the result. help me @Rik
AF(1,1)= 0;n=[4 16]; %no of ele
phi1=[90:90:360 zeros(1,12); 22.5:22.5:360]
l=[1 4] %mode
r=[0.5 2.5]*lambda %radii of each ring
k=(2*pi)/(lambda);
phio=0;
phi=0;
theta=0;
for m=1:2
for i=1:n(m)
AF= AF + (exp((1j).*(((k)*(r(m))*(sin(deg2rad(theta)))*(cos((deg2rad(phi))-(deg2rad(phi1(m,i))))) + ((l(m))*((-k)*r(m)*cos((deg2rad(phio))-(deg2rad(phi1(m,i))))))))));
end
AFk=abs(AF);
end
FARHA KHAN
FARHA KHAN 2021년 12월 23일
I am getting the output @Rik. as 9.741 .
I want to know this program is right?As I am not getting required output which should be zero.
Rik
Rik 2021년 12월 23일
I can't properly read you function, so I can't absolutely confirm you did it correctly.
The main advice I have for you is to split your calculation into several parts you can more easily read. One main thing would be to move the calls to deg2rad outside the loop.
If you post a clearer version of your mathematical notation I can try to help you check if this is correct.
FARHA KHAN
FARHA KHAN 2021년 12월 23일
Can you see this @Rik
Yes, this I can read.
I would convert this to Matlab as follows:
lambda=__;
M=2;
N=[4 16];
K=(2*pi)/lambda;
r=[0.5 2.5]*lambda;
theta=0;
phi=[90:90:360 zeros(1,12); ...
22.5:22.5:360];
phi_=0;
alpha=__;
s=0;
for m=1:M
for n=1:N(m)
tmp=K * r(m) * sin(theta) * cos(phi_-phi(m,n)) + alpha(m,n);
s=s + W(m) * exp(1j*tmp);
end
end
FARHA KHAN
FARHA KHAN 2021년 12월 23일
alpha(m,n)=-k*r(m)*cos(phi0-phi(m,n)) @Rik
FARHA KHAN
FARHA KHAN 2021년 12월 23일
편집: Walter Roberson 2021년 12월 24일
intializing s as?
M=2
for m=1:M
for n=1:n(m)
tmp=(k * r(m) * sin(theta) * cos(phio-phi(m,n))) - (k * r(m) * cos(phio-phi(m,n)));
s=s + W(m) * exp(1j*tmp);
end
end
@rik
FARHA KHAN
FARHA KHAN 2021년 12월 23일
tq it was bit helpful @Rik
You could also calculate alpha in your loop:
s=0;
for m=1:M
for n=1:N(m)
alpha=-K*r(m)*cos(phi0-phi(m,n));
tmp=K * r(m) * sin(theta) * cos(phi0-phi(m,n)) + alpha;
s=s + W(m) * exp(1j*tmp);
end
end
FARHA KHAN
FARHA KHAN 2021년 12월 24일
yeah tq @Rik

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

도움말 센터File Exchange에서 MATLAB Support Package for Raspberry Pi Hardware에 대해 자세히 알아보기

제품

릴리스

R2021a

질문:

2021년 12월 23일

편집:

2021년 12월 24일

Community Treasure Hunt

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

Start Hunting!

Translated by