www.pudn.com > mka_m_series.zip > mka_m_series.m


%  产生生成矩阵A; 
%%%  there is 4095 points of the m series; 
clear all; 
A=zeros(12,12); 
for i=1:11 
    A(i,i+1)=1; 
end; 
    A(12,1)=1; A(12,7)=1;  A(12,9)=1;  A(12,12)=1; 
% originate the vector; 
  x=zeros(12,1);  x(1)=1; 
% makeout the m series; 
   y=zeros(1,4095); 
for i=1:4095 
    y(i)=x(1); 
    x=A*x; 
    x(12)=mod(x(12),2); 
end; 
     y; 
     for i=1:4095 
         if y(i)>=1 
            y(i)=1; 
        elseif y(i)<=0 
               y(i)=-1; 
         end; 
     end; 
          
           Mm=y;   %%%   define a new variable easiely to memory 
            %%%%   随机序列产生完毕; 
     %%%  计算自相关函数; 
     %%%  先计算自身的相关函数,在计算与信道响应卷积后的自身的相关函数; 
            
           delay=4095; 
           A=zeros(delay,4095); 
       for i=1:delay 
           y1=zeros(size(y)); 
           y1(i:4095)=y(1:4095-i+1); 
           y1(1:i-1)=y(4095-i+2:4095); 
           A(i,:)=y1; 
            
       end; 
           figure; subplot(211);  %%%%    y'  must be a column vector; 
           b1=multiply(A,y'); 
           plot(b1);    
           title('corelation of itself'); 
            
         %%%%%%  corelation after   convolution;    
              Hn =[0.8783   -0.5806    0.6537   -0.3223    0.6577   -0.0582   0.2895   -0.2710    0.1278   -0.1508    0.0238   -0.1814   0.2519   -0.0396    0.0423   -0.0152    0.1664   -0.0245   0.1463   -0.0770    0.1304   -0.0148    0.0054   -0.0381    0.0374   -0.0329    0.0313   -0.0253    0.0552  -0.0369   0.0479   -0.0073    0.0305   -0.0138    0.0152   -0.0012  0.0154   -0.0092    0.0177   -0.0161    0.0070   -0.0042  0.0051   -0.0131    0.0059   -0.0041    0.0077   -0.0034   0.0074   -0.0014    0.0025   -0.0056    0.0028   -0.0005   0.0033   -0.0000    0.0022   -0.0032    0.0012   -0.0020   0.0017   -0.0022    0.0004   -0.0011      0          0   ]; 
              Hn=Hn(1:64); 
              y=conv(y,Hn); 
             y=y(1:4095); 
              delay=4095; 
           A=zeros(delay,4095); 
       for i=1:delay 
           y1=zeros(size(y)); 
           y1(i:4095)=y(1:4095-i+1); 
           y1(1:i-1)=y(4095-i+2:4095); 
           A(i,:)=y1; 
            
       end; 
           hold on; 
           subplot(212);  %%%%    y'  must be a column vector; 
           b2=multiply(A,y'); 
           plot(b2);    
           title('corelation of convolution');