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

📄 xiaospectra30m.m

📁 这是自己写得一个求GOLD码的一个matlab 的源程序!如果没有输入
💻 M
字号:
function [] = XiaoSpectra30M(Arr1,Arr2);
%---------------------------------------------------------------------
% You should input two array ,they must have the same length ,if not , 
% there will be something wrong.
%  There is also have a Gauss rand for example
%  the communication university of china 
%  zhangpengju 2008.10.31
%  Gold code 
%  The main work is for sloving the mod 
if nargin < 2 ;
   Arr1=[1,1,0,0,1,0,1,0];
   Arr2=[0,1,1,0,1,0,1,0];  
   A_xor_B = xor(Arr1,Arr2);
end;
%  The figure after the mod 
    L1 = length(Arr1);
    L2 = length(Arr2);
   if ( L1 ~= L2 );
      error('The length of the arry Arr1 and Arr2 must have the same length , Please check ');
   end;   
   A_xor_B = xor(Arr1,Arr2);
   subplot(3,1,1),Sequence(Arr1);title('The Arry NO.1');
   subplot(3,1,2),Sequence(Arr2);title('The Arry NO.2');
   subplot(3,1,3),Sequence(A_xor_B);title('The MOD of No.1 and NO.2');
% FFT  the spectra 
   Window = figure('Name','Spectra',......
                   'NumberTitle','off','Position',[200 80 600 500]);
   y = fft(Arr1)/L1;
   y = abs(y)*2;
   plot(y,'r');title('The Spectra of the GoldRand');
   axis([0.9 L1+0.2 0 1.1]);  % start from 0.9 point.
   zoom on;grid ;
% Here is comparation  using Gauss rand.
  WinExample = figure('Name','Example_Guass',......
                   'NumberTitle','off','Position',[180 50 600 500]);   
  Radom = randn(100,1);
    y = fft(Radom)/length(Radom);
    y = abs(y);
    plot(y);title('The Spectra of the GuassRand');
    grid ;
  %  axis([.5 11 0 1])
% End of the function 

% for test the program
%SOURCE CODE : 
%     A =  rand(1,100);
%     A =  round(A);
%     B =  rand(1,100);
%     B =  round(B);
%     XiaoSpectra30M ( A,B); 
 % END OF  THE TEST .

⌨️ 快捷键说明

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