www.gusucode.com > sigdemos 工具箱matlab源码程序 > sigdemos/private/winintegrate.m

    function y = winintegrate(x,Tp)
%WININTEGRATE Numerically integrates window function
%  WINI = WININTEGRATE(WIN,T) - returns the integral function WINI
%  which is numerically computed from the passed vector WIN. The 
%  integral is computed using a simple trapezoid method.  The period
%  of the input waveform is passed by T.  This defines the period
%  of time spanned by the input function.  
%
%  See also WINDTRANDEMO, WINORDERFIRST, SCALEWINFO 

%   Author(s): A. Dowd, Tom Bryant
%   Copyright 1988-2002 The MathWorks, Inc.
%
step=Tp/(length(x)-1);
y=[0 (x(1:end-1)+x(2:end))*step/2];
y(2:end) = y(2:end)+cumsum(y(1:end-1));

% [EOF] winintegrate.m