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

📄 readhead.m

📁 This is a collection of m-files I created to complete a research project into the DC components of v
💻 M
字号:
%READHEAD(IN)
%   This function translates a NRZ signal into what a read head
%   from a magnetic disk would read.  It's values are -1, 0, and 1.
%
%   Although it is not necessary to illustrate each possibility,
%   because the array is initialized to zero, they are still
%   shown for clarity.

function out = readhead(in)

a=zeros(1,length(in));
a(1)=in(1);
for i=2:length(in)
    if in(i-1) == 0
        if in(i) == 0
            a(i) = 0;
        end
        if in(i) == 1
            a(i) = 1;
        end
    end
    if in(i-1) == 1
        if in(i) == 0
            a(i) = -1;
        end
        if in(i) == 1
            a(i) = 0;
        end
    end
end

out = a;

⌨️ 快捷键说明

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