www.gusucode.com > dsp 案例源码程序 matlab代码 > dsp/DetermineTheNumberOfZeroCrossingsExample.m
%% Determine The Number of Zero Crossings %% % *Note*: This example runs only in R2016b or later. If you are using an % earlier release, replace each call to the function with the equivalent % |step| syntax. For example, myObject(x) becomes step(myObject,x). %% % Find number of zero crossings in electrocardiogram data. EcgData = ecg(500)'; Hzerocross = dsp.ZeroCrossingDetector; NumZeroCross = Hzerocross(EcgData); % Equal to 4 plot(1:500,EcgData,'b',[0 500],[0 0],'r','linewidth',2);