Be the first to rate this file! 76 downloads (last 30 days) File Size: 1.93 KB File ID: #25738

Level crossings

by roberto madia

 

04 Nov 2009

Code covered by BSD License  

Detect level crossing of signals.

Download Now | Watch this File

File Information
Description

LC_FAST calculates how many times a given input signal crosses a set of levels.
It is much faster than traditional algorithms being designed to handle big datasets.

MATLAB release MATLAB 7.6 (R2008a)
Zip File Content  
Other Files lc_fast.m,
license.txt
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Comments and Ratings (3)
05 Nov 2009 Martin Lechner

This function has problems with consecutive equal values. They are also counted as crossings.

lc_fast([0;1;1;1;1;1;0],1)
ans = 4

I would expect for the example above: 1

05 Nov 2009 Jos (10584)

Just curious what you mean by "This algorithm is generally faster than traditional ones". What are the traditonal ones?

I would suspect that an operation using something using DIFF and SIGN, as in (not-tested) "sum(diff(sign(Signal-OneLevel))) ~= 0)" is faster (as well as shorter)

05 Nov 2009 roberto madia

 "Traditional" algorithms means algorithms based on sum(diff(sign(Signal-OneLevel))) ~= 0) method.
For large datasets this routine is at least 5 times faster.

In case of consecutive equal values this routines calculates all crossings even tough they are all equals.

Please login to add a comment or rating.
Tag Activity for this File
Tag Applied By Date/Time
data export roberto madia 04 Nov 2009 09:34:55
zero crossing roberto madia 04 Nov 2009 09:34:56
mathematics roberto madia 04 Nov 2009 09:34:56
signal processing roberto madia 04 Nov 2009 09:34:56
statistics roberto madia 04 Nov 2009 09:34:56
data exploration roberto madia 04 Nov 2009 09:34:56
data import roberto madia 04 Nov 2009 09:34:56
level crossing roberto madia 04 Nov 2009 09:34:56
zero detect roberto madia 04 Nov 2009 09:34:56
level detect roberto madia 04 Nov 2009 09:34:56
level crossing method roberto madia 04 Nov 2009 09:34:56
level crossing rate roberto madia 04 Nov 2009 09:34:56
 

MATLAB Central Terms of Use

NOTICE: Any content you submit to MATLAB Central, including personal information, is not subject to the protections which may be afforded information collected under other sections of The MathWorks, Inc. Web site. You are entirely responsible for all content that you upload, post, e-mail, transmit or otherwise make available via MATLAB Central. The MathWorks does not control the content posted by visitors to MATLAB Central and, does not guarantee the accuracy, integrity, or quality of such content. Under no circumstances will The MathWorks be liable in any way for any content not authored by The MathWorks, or any loss or damage of any kind incurred as a result of the use of any content posted, e-mailed, transmitted or otherwise made available via MATLAB Central. Read the complete Terms prior to use.

Contact us at files@mathworks.com