%% Determine Number of Zero Crossings
% Note: If you are using R2016a or an earlier release, replace each call to the object with the equivalent step syntax. For example, obj(x) becomes step(obj,x).
% Find the number of zero crossings in electrocardiogram data.

EcgData = ecg(500)';
zcd = dsp.ZeroCrossingDetector;
numZeroCross = zcd(EcgData)
plot(1:500,EcgData,'b',[0 500],[0 0],'r','linewidth',2)

% Copyright 2012 The MathWorks, Inc.