beampattern calculation for linear array.

11 views (last 30 days)
Kugen Raj
Kugen Raj on 5 Jan 2012
angle=0 degree.
N=100 Ref. node (x1,y1)=(600,400)
disatance between ref. node and destination node= 500
inter-element spacing =.1*(lambda)
angle=0*(pi/180);
D=500;%distance between ref. node and destination.
x1=600;%ref. node value.
y1=400;
xd=x1+(D*cos(angle)); %destination value
yd=y1+(D*sin(angle)); %destination value
N=100;%number of elements
freq=3e9;
c=3e8;
lambda=c/freq;
for n=1:N
d_s(n)=(x1-(.1*lambda))+(n*(.1*lambda));%inter-element spacing between sensor
d(n)= sqrt((yd-y1)^2+(xd-d_s(n))^2);
t(n)= ((2*pi)/lambda)*(d(1)-d(n));
c(n)=exp(-i*t(n));
for angle=1:360
d(n,angle)=sqrt((y1+(D*sin(angle)))-y1)^2+(((x1+(D*cos(angle)))-d_s(n))^2);%distance between destination and sensor
k(n,angle)=((2*pi)/lambda)*(d(1,angle)-d(n,angle)); %phase lag for each sensor
y(n,angle)=(exp(-i*k(n,angle))*c(n)); %weight multiplication to correct the phase lag
end
end
figure(1);
plot (x1, y1, '*b', xd, yd, 'o');
figure(2);
plot (d_s, y1, '.');
Y=sum(y);
YY=abs(Y);
figure(3);
plot(YY);
In figure(3), i tried to plot energy versus angle graph. i should get 100dB for energy since i have 100 elements. But, all im getting is (0-30)dB only. Can anyone help me with this? thanks in advance.

Answers (2)

the cyclist
the cyclist on 5 Jan 2012
I haven't looked in detail, but it looks like maybe in your for loop, you are using "angle" in degrees, but calculating cos() and sin(), which expect radian input.
  2 Comments
Kugen Raj
Kugen Raj on 5 Jan 2012
i acc. changed the angle from degree to radian before the calculation for the destination node..
the cyclist
the cyclist on 5 Jan 2012
Are you sure? After the statement "for angle=1:360", you seem to be using sin(angle) and cos(angle) without any conversion factor in there.

Sign in to comment.


Honglei Chen
Honglei Chen on 5 Jan 2012
Besides what cyclist mentioned, I think there are several other issues in your code:
  1. 100 elements translates to 20dB, not 100dB
  2. That 20dB is on power while your YY is in magnitude.
  3. You are assuming spherical wave, not plane wave, so I'm not sure if you will get 20dB
  4. Your phase compensation doesn't seem right. You are basically doing exp(-1i*k(n,angle))*exp(-1i*t(n)), which is incorrect.
HTH

Community Treasure Hunt

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

Start Hunting!