hi, im work with smart antenna beamforming and i will use swarm optimization algorithm the problem is :i want to design 3d Hexagonal Prism Array im work with this code that i have in it apatteren with out any directionaly!!can some one help me
2 次查看(过去 30 天)
显示 更早的评论
%%in this code i use the last mean square algorithm%%
clc;
clear;
fo=900*10^6;
co=3*10^8;
lm=co/fo;
M = 22;
DOAu1 =0;
a=lm/4;
b=lm/2;
c=3*lm/4;
d=lm;
e=1.5*lm;
f=2*lm;
g=3*lm;
dis=b;
d1=0.6667;
d2=1.1547;
d3=1.3333;
d4=1.1547;
d5=0.6667;
DOAu11=DOAu1*pi/180;
u1 =sign(randn(1,500));
n=length(u1);
nn=(randn(n,M)+j*randn(n,M))*0.1;
mu=0.008;
Tu1=20*10^(-6);
ru=zeros(3,M);
xu=zeros(3,M);
XU=zeros(1,M);
yu=zeros(3,M);
eu=zeros(3,n);
Bu=zeros(3,n);
wu=zeros(3,M);
Gainu1=0.5*(exp(j*pi/2));
for k=1:n
U1=Gainu1*repmat(u1(k),1,M);
for m=1:M
ph =90; % E-plane, phi = 90 for H-plane
phi = ph*pi/180;
Kx=dis*2*pi*sin(DOAu11)*cos(phi);
Ky=dis*2*pi*sin(DOAu11)*sin(phi);
Kz=dis*2*pi*cos(phi);
Au1=exp(-j*2*pi*f*Tu1);
AF1(m)=exp(-j*2*pi*(m-1)*dis*sin(DOAu11)/lm)*exp(-j*(m-1)*Kz*dis);
AF2(m)=exp(-j*2*pi*(m-1)*dis*sin(DOAu11)*cos(phi-(pi/3))/lm)*exp(-j*(m-1)*Kz*dis)*exp(-j*Kx*d1);
AF3(m)=exp(-j*2*pi*(m-1)*dis*sin(DOAu11)*cos(phi-2*pi/3)/lm)*exp(-j*(m-1)*Kz*dis)*exp((-j*Kx*cos(pi/6)+Ky*sin(pi/6))*d2);
AF4(m)=exp(-j*2*pi*(m-1)*dis*sin(DOAu11)*cos(phi-pi))*exp(-j*(m-1)*Kz*dis)*exp((-j*Kx*cos(2*pi/6)+Ky*sin(2*pi/6))*d3);
AF5(m)=exp(-j*2*pi*(m-1)*dis*sin(DOAu11)*cos(phi-(4*pi/3))*exp(-j*(m-1)*Kz*dis)*exp((-j*Kx*cos(3*pi/6)+Ky*sin(3*pi/6))*d4));
AF6(m)=exp(-j*2*pi*(m-1)*dis*sin(DOAu11)*cos(phi-(5*pi/3))*exp(-j*(m-1)*Kz*dis)*exp((-j*Kx*cos(4*pi/6)+Ky*sin(4*pi/6))*d5));
Bu1(m)=AF1(m)+AF2(m)+AF3(m)+AF4(m)+AF5(m)+AF6(m);
ru(1,m)=U1(m)*Au1*Bu1(m);
xu(1,m)=ru(1,m)+nn(k,m);
end;
%Calculat error
yu(1,k)=xu(1,:)*wu(1,:)';
eu(1,k)=u1(k)-yu(1,k);
wu(1,:)=wu(1,:)+mu*xu(1,:)*conj(eu(1,k));
Bu(1,k)=eu(1,k)*eu(1,k)';
end;
q=0;
wu(1,:)=conj(wu(1,:));
for angle1=-90*pi/180:1*pi/180:90*pi/180;
q=q+1;
AF11(q)=exp(j*(m-1)*2*pi*dis*sin(angle1)/lm)*exp(j*(m-1)*Kz*dis);
AF21(q)=exp(j*(m-1)*2*pi*dis*sin(angle1)*cos(phi-(pi/3))/lm)*exp(j*(m-1)*Kz*dis)*exp(j*Kx*d1);
AF31(q)=exp(j*(m-1)*2*pi*dis*sin(angle1)*cos(phi-2*pi/3)/lm)*exp(j*(m-1)*Kz*dis)*exp((j*Kx*cos(pi/6)+Ky*sin(pi/6))*d2);
AF41(q)=exp(j*(m-1)*2*pi*dis*sin(angle1)*cos(phi-pi))*exp(j*Kz*dis)*exp((j*(m-1)*Kx*cos(2*pi/6)+Ky*sin(2*pi/6))*d3);
AF51(q)=exp(j*(m-1)*2*pi*dis*sin(angle1)*cos(phi-(4*pi/3))*exp(j*Kz*dis)*exp((j*(m-1)*Kx*cos(3*pi/6)+Ky*sin(3*pi/6))*d4));
AF61(q)=exp(j*(m-1)*2*pi*dis*sin(angle1)*cos(phi-(5*pi/3))*exp(j*Kz*dis)*exp((j*(m-1)*Kx*cos(4*pi/6)+Ky*sin(4*pi/6))*d5));
angle2(q)=AF11(q)+AF21(q)+AF31(q)+AF41(q)+AF51(q)+AF61(q);
for t=1:M
G(t)=exp(j*angle2(q)*(t-1));
end;
beamu1(q)=abs(wu(1,:)*G');
end;
% figure(1);clf;
% polar(-90*pi/180:1*pi/180:90*pi/180,beamu1);
% hold on;
%
% view(90,-90);
% grid on;
% zoom on;
figure(2);clf;
th=-90:1:90;
plot(th,beamu1,'LineWidth',1);
grid on;
title('Linear Plot Pattern of First Signal-1st DOA');
0 个评论
回答(0 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!