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

📄 makerll.m

📁 This is a collection of m-files I created to complete a research project into the DC components of v
💻 M
字号:
%makeRLL(in,d,k)
%   This function creates a random sequence of a little more than 'in' bits 
%   valued at 0 and 1, which meets a run-length limited (d,k) constraint.
%   This is an NRZI code.

function out = makeRLL(in,d,k)

sum = 0;
for i = d+1:k+1
    sum = sum + exp(-i);
end
K = 1./sum;

M = cell(k-d+1,1);
for i = 1:k-d+1
    M{i} = [zeros(1,d+i-1) , 1];
end

chain = [];
while length(chain) < in
    x = rand;
    likeacdf = 0;
    for i = 1:k-d+1
        likeacdf = likeacdf + K*exp(-length(M{i}));
        if x < likeacdf
            chain = [chain M{i}];
            break            
        end
    end
end

out = chain;

⌨️ 快捷键说明

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