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

📄 first.asv

📁 用matlab做的一个模糊天气预报系统
💻 ASV
字号:
%the ga program   
%the program for the y=x*sin(10*pi*x)+2 to research the bigest or mallest
%one at [-1,2]
  
clc
lytotall=2^16;                    % totall group for code   for 16 bin
  lychoisesnum=wsstotall/2^8;     %first for selection  or the group is  2^8 num
temptime(lytotall)=0;             %for selection
lytemp(lychoisesnum)=0;          % seclection for rocerding

inheritproble=0.25;    
lystart=5;
lychanges=0.01;


%choice the first time
for i=0:lychoisesnum-1        % rand make the bin to the array lytemp 
    tempk=fix(rand(1,1)*8);
    lytemp(i+1)=i*2^8+tempk;
end


 %choice for circle
for  wholei=1:8
      wholej=9-wholei;      % the half for cirlce  so have eight circle
    lychoisesnum=2^wholej;  %the decide how many for next circle
    
    %select the half group
   lytemp1=wsstemp(1:lychoisesnum);
   
   wholenumber=1+65536.*lytemp1/(lytotall-1); %bin to the real
 lyeval=wholenumber.^(-wholenumber/2);  %the adapt
 
   
    [temptime1,numtime]=sort(lyeval); % the order and the numtime record the bigs
    
     
    for i=1:2^wholej/2
        lytemp(i)=lytemp1(numtime(i+2^wholej/2));%update for the large one    if you want the small one,please cut off the '+2^wholej/2'
    end

    
%for the two for their children
for i=1:lychoisesnum*inheritproble/2   
    inheritnum1=ceil(rand(1,1)*lychoisesnum);   %to choise the parents
     inheritnum2=ceil(rand(1,1)*lychoisesnum);  
     k1=lytemp(inheritnum1);
     k2=lytemp(inheritnum2);  
                             
      inherit1=binnum(k1,16);           %for bin                             
      inherit2=binnum(k2,16);
      
   [kk1,kk2]=lyinherit(inherit1,inherit2,lystart);   %for making 
    
   %inherit1,inherit2
     wsstemp(inheritnum1)=wssnumber(kk1,16);  %return the number
    wsstemp(inheritnum2)=wssnumber(kk2,16);
    
end


% the anther variation 
    wsschangerand=fix(rand(1,1)*16)+1;
    
for i=1:wsschoisesnum*wsschanges
    k=ceil(rand(1,1)*wsschoisesnum);
  
       wsschangebin=binnum(wsstemp(k),16);
        wsschangebin(wsschangerand)= ~wsschangebin(wsschangerand);  %variable 
       wsstemp(k)=wssnumber(wsschangebin,16);
   end
   
       
 end      %class over
 
  % wsstemp(1)=50300;
resultx=1+65536*wsstemp(1)/(wsstotall-1)
 resulty=resultx.^(-resultx/2)
 
 
 %i have two lines to work out this program 1: the x  , only for first
 %selection  2: bin number for  change,vary    
 %the important things is the well using the array wsstemp, wsstemp1 to
 %record the results of the bin numbers

⌨️ 快捷键说明

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