u_step.m

来自「《Digital and Analog Communications Syste」· M 代码 · 共 34 行

M
34
字号
function y = u_step(t,Tbegin)
% FILE: U_STEP.M
% CALL: y = u_step(t,Tbegin)
% This file creates a unit step for the time vector "t"
% that begins at time t=Tbegin.

n = length(t);
i = 1;
j = 0;

temp = 0;
while(temp == 0)
  if (t(i) >= Tbegin)
    temp = 1;
    j = i;
  else
    i = i+1;
    if (i > n)
      temp = 1;
    end;
  end;
end;

y = zeros(n,1);
if (j > 0)
  for (i = j:1:n)
    y(i) = 1;
  end;
end;
end;



⌨️ 快捷键说明

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