pulsegen.m
来自「数字通信第四版原书的例程」· M 代码 · 共 29 行
M
29 行
function [sys,x0] = pulsegen(t,x,u,flag,height,width,dt)
%PULSEGEN generates perfect pulse for communication toolbox.
% Wes Wang
% Copyright (c) 1995-96 by The MathWorks, Inc.
if flag == 2 %refresh states
sys(1) = rem(x(1)+1,2);
if (sys(1)==1)
sys(2) = 1;
sys(3) = width;
else
sys(2) = 0;
sys(3) = dt - width;
end;
elseif flag == 3 %output calculation
sys = x(2);
elseif flag == 4 %
sys = t + x(3);
elseif flag == 0 %initial condition
sys = [0;3;1;0;0;1];
x0 = [0,0,width]; %phase, pulse value, dt;
if dt<width
error('The pulse width cannot be larger than sampling time')
end;
else
sys = [];
end;
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?