⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 antenna.asv

📁 对于天线的设计和应用进行了仿真,并进行了优化处理
💻 ASV
字号:
close all
clear all
clc
% set parameter
M=80;
M2=M/10;
M3=M-M2;
T=2;
Pc=0.6;
Pm=0.004;
N=7;
Len=10;
Lenth=N*Len;
Phi=zeros(M,Lenth);
BestValue=zeros(1,T);
% Generater the first generation of the population
Chro=round(rand(M,Lenth));
Phi=DecodeChro(Chro,M,Lenth,N,Len);
Phi=pi*Phi/2046;
figure(1)
mesh(Phi)






MinFitness=zeros(1,T);
AveFitness=zeros(1,T);
for Gen=1:T
% Calculate Object fitness
Phi=DecodeChro(Chro,M,Lenth,N,Len);

Phi=pi*Phi/2046;



Fitness=CalculateObjectValue(Phi,M,N);
Sum=sum(Fitness);
CFitness=Fitness/Sum;
AveFitness(Gen)=Sum/M;
% select operation
[Cost,ind]=sort(CFitness);
MinFitness(Gen)=Fitness(ind(1));
 Sel=ceil(rand(M3,1)*M);
 for j=1:M3
        if CFitness(ind(M2+j)) > CFitness(Sel(j))
         ind(M2+j)=Sel(j);
    end
end
Chro=Chro(ind(1:M),:);
    
    
% crossover operation
IndexPair=zeros(M,1);
for j=1:M
    IndexPair(j)=j;
end
for j=1:M
    Point=floor((M-j-1)*rand(1));
    Temp = IndexPair(j) ;
    IndexPair(j) = IndexPair( j + Point );
    IndexPair(j+Point) = Temp;
end
for j=1:2:(M-1)
   Randp=rand(1);
   if Randp<Pc
       P=ceil(rand(1)*(Lenth-Len));
           for k=P:(P+Len-1)
           Temp = Chro(j,k) ;
           Chro(j,k) = Chro(j+1,k) ;
           Chro(j+1,k) =Temp;
       end
   end
end
Chro(M,:)=Cost(1,:);
% mutation
for j=1:M
    for k=1:Lenth
        Randp=rand(1);
        if Randp<Pm
            if Chro(j,k)==1
                Chro(j,k)=0;
            else
                Chro(j,k)=1;
            end
        end
    end
end
end
Phi=DecodeChro(Chro,M,Lenth,N,Len);
Phi=pi*Phi/2046;
figure(2)
mesh(Phi)
figure(3)
hold on
plot( MinFitness,'r'),
plot(AveFitness,'b'),axis[0,;
hold off

BestPhi=zeros(1,N);
BestPhi=Phi(ind(1),:);
dr=0.8;
k=2*pi*dr;
max=0;
s=0;
Value=ones(1,201);
    for f=-1:0.01:1
        s=s+1;
        for n=1:N
            Value(1,s)=Value(1,s)+exp(i*(k*f*n+BestPhi(1,n)));
        end
        Value(1,s)=abs(Value(1,s));
        if max<Value(1,s)
            max=Value(1,s);
        end
    end
    figure(4)
    f=-1:0.01:1;
    Value=Value./max;
    Value=20*log10(Value);
    plot(f,Value),grid;





⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -