www.pudn.com > cyclostationary_toolbox.rar > get_impulses.m, change:1997-11-25,size:972b


function [p,m,md,s]=get_impulses(ts,threshold,max_std)
%
% GET_IMPULSES
%                   get impulses from a noisy series of pulses
%                   
% USAGE 
%                   [p,m,md,s]=get_impulses(x,threshold,max_deviation)
%                 
%                   Detects pulses p as a change in the signal > threshold
%                   Changes closer than max_deviation percent of the 
%                   median pulse difference are discarded.
%
%                   Provides mean(m), median (md) and standard deviation(s)
%                   of times between pulses

% File: get_impulses.m
% Last Revised: 25/11/97
% Created: 25/11/97
% Author: Andrew C. McCormick
% (C) University of Strathclyde


d=diff(ts);

p=find(d>threshold);

md=median(diff(p));
x=find(diff(p)>md-(max_std*md/100));
p=p(x);
md=median(diff(p));
x=find(diff(p)<md+(max_std*md/100));
p=p(x);

dp=diff(p);
x=find(dp<md+(max_std*md/100));
md=median(dp(x));
m=mean(dp(x));
s=std(dp(x));