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

📄 random.m

📁 generate a normal sequence from rayleigh distribution
💻 M
字号:
%Generate a random sequence of such length definded in the arguement..
%Programmed by Benjamin.Frank, 05-Mar-2009
%

function y = random(n)
% y = ceil(10*rand(1,n))
% n = 5;
% n = input('Enter the number of the random sequence:');
% n = 10;
if 1,
    y(1) = ceil(n*rand);
    for i=2:n,
        y(i) = ceil(n*rand);
%         for j=1:i-1,
%             if y(j)~=y(i)
%                 ;
%             else 
%                 y(i) = ceil(n*rand);
%                 break;
%             end
%              j = 1;
             while length(find(y([1:i-1])-y(i)))<length(y([1:i-1])),
                 y(i) = ceil(n*rand);
%                  if j<i-1,
%                      j = j+1;
%                  else
%                      break;
%                  end
             end
%         end
    end
end



⌨️ 快捷键说明

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