zero crossing and inflection point
1 view (last 30 days)
Show older comments
Osita Onyejekwe
on 1 Nov 2016
Answered: John D'Errico
on 1 Nov 2016
can someone please in detail explain to me what this simple line of coding is doing in order to calculate zero crossing. I thought you needed the second derivative of the function to do this. Thank you
zci = @(v) find(v(:).*circshift(v(:), [-1 0]) <= 0);
0 Comments
Accepted Answer
John D'Errico
on 1 Nov 2016
Why would you possibly need the second derivative to locate a zero crossing?
All this does is look for consecutive elements of a vector that have different signs.
If you really want to see what it does, read the help for circshift. My re-writing existing help will be a waste of time. Given that, what property do two numbers have if they have different signs? Answer: the product will ALWAYS be negative. So all that line does is look for consecutive elements with opposite signs. (Zero will do too.)
0 Comments
More Answers (0)
See Also
Categories
Find more on Logical in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!