tripuls.m
来自「有关matlab的电子书籍有一定的帮助希望有用」· M 代码 · 共 36 行
M
36 行
function y = tripuls(t,Tw,skew)
%TRIPULS Sampled aperiodic triangle generator.
% TRIPULS(T) generates samples of a continuous, aperiodic,
% unity-height triangle at the points specified in array T, centered
% about T=0. By default, the triangle is symmetric and has width 1.
%
% TRIPULS(T,W) generates a triangle of width W.
%
% TRIPULS(T,W,S) allows the triangle skew S to be adjusted. The
% skew parameter must be in the range -1 < S < +1, where 0 generates
% a symmetric triangle.
%
% See also GAUSPULS, RECTPULS, PULSTRAN.
% Author(s): D. Orofino, 4/96
% Copyright (c) 1988-98 by The MathWorks, Inc.
% $Revision: 1.5 $
error(nargchk(1,3,nargin));
if nargin<2, Tw=1; end
if nargin<3, skew=0; end
if (skew<-1) | (skew>1),
error('Skew value must be in the range -1<=k<=1.');
end
% Compute triangle function output:
Ta=Tw/2*skew;
y=zeros(size(t));
i = find( (t>(-Tw/2)) & (t<Ta) );
y(i) = (2*t(i)+Tw)./(Tw*(1+skew));
i = find( (t>Ta) & (t<Tw/2) );
y(i) = 1 - (2*t(i)-skew*Tw)./(Tw*(1-skew));
y(find(t==Ta)) = 1.0;
% end of tripuls.m
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?