資源簡介
天線直線陣 利用遺傳算法優(yōu)化饋電相位以降低副瓣電平
代碼片段和文件信息
clc;
clear?all;
close?all;
for?ttt=1:1
????
????%---------------------二進制編碼----Phase?Only---------------------
????c=3e8;?????????????????????%?光速
????fc=6e9;????????????????????%?工作頻率(hz)6GHz
????numda=c/fc;????????????????%?波長?wave?length
????
????N=20;??????????????????????%?陣列數(shù)
????d=0.5*numda;???????????????%?陣元間距
????L=N*d;?????????????????????%?天線長
????k=(2*pi)/numda;????????????%?波數(shù)
????fs=10;??????????????????????%?采樣頻率
????theta=-90:1/fs:90;????%?方位角度范圍(采樣范圍)(rad)
????theta1=-90;
????theta2=90;
????Ns=length(theta);??????????%?采樣點數(shù)
????
????theta_d=0;????????????????%?主波束方向
????%?theta_d=0時w1=w2=...=wM=1此時即為靜態(tài)方向圖
????u=sin(theta*pi/180)-sin(theta_d*pi/180);
????v=k*d*u;
????
????fitness_function=2;??%?適應度函數(shù)選擇
????selection_method=3;??%?選擇方法[12345]
????crossver_method=1;???%?交叉方法[12345]
????mutation_method=1;???%?變異方法[123]
????N_mult=2;????????????%?多點變異點數(shù)
????%---------------------參數(shù)設置------------------------
????SLVL=-20;
????R=10.^(-SLVL/20);
????gen_max=100;
????popsize=50;
????coef=10;
????%-----------------------GA---------------------------
????N0=(Ns-1)/2+1+round(Ns/2*theta_d/90);??%the?mainbeam?center?index
????theta0=asin(numda/(N*d))*180/pi;
????Ns0=round(theta0*fs);
????
????%--------------------相位量化-------------------------------
????N_bit=5;???????????????????????%?量化精度
????Step_quant=360/(2.^N_bit);?????%?量化間隔
????fs_quant=1/Step_quant;
????
????theta_quanti_room=0:Step_quant:360;???????%?theta_quanti_room=-180:Ts_quant:180
????N_length=length(theta_quanti_room);??????%?量化空間大小
????
????%====================初始染色體==============================================
????%------產(chǎn)生初始染色體------------
????theta_init=zeros(coef*popsizeN/2);
????pos_init=randi([1N_length]coef*popsizeN/2);
????theta_init=theta_quanti_room(pos_init);
????W_init=exp(j*k*d*sind(theta_init));
????
????%------初始方向圖----------------
????E_init=zeros(coef*popsizeNs);
????for?n=1:coef*popsize
????????for?m=1:N/2
????????????E_init(n:)=E_init(n:)+W_init(nm)*cos((2*m-1)/2*v);
????????end
????????S_init(n:)=abs(E_init(n:))/max(abs(E_init(n:)));
????????G_init(n:)=20*log10(S_init(n:));??%?G=20*log10(abs(E/I));
????????MSLL_init(n)=?min(abs(?G_init(n[1:(N0-Ns0)(N0+Ns0):Ns?])));
????end
????
????%-----適應值計算-----------------
????if?fitness_function==1
????????fitness_init=MSLL_init;????%?適應度函數(shù)
????elseif?fitness_function==2
????????fitness_init=1./(1*abs(abs(MSLL_init)-abs(SLVL)));
????end
????
????%--------從好到壞排序--------------
????[fitness_init_resite0]=sort(fitness_init‘descend‘);
????MSLL_init_re=MSLL_init(site0);
????pos_init_re=pos_init(site0:);
????theta_init_re=theta_init(site0:);
????W_init_re=W_init(site0:);
????E_init_re=E_init(site0:);
????S_init_re=S_init(site0:);
????G_init_re=G_init(site0:);
????
????%-----------選擇父本--------------
????fitness_father=fitness_init_re([1:popsize]);
????MSLL_father=MSLL_init_re([1:popsize]);
????pos_father=p
評論
共有 條評論