"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.
"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.
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)
"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.
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)
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
Comment only