04-24-2009 04:38 AM
Hello,
I have been going a this for awhile and haven't been able to figure it out so any help would be appreciated.
I'm trying to extract the values corresponding to the bottom of a valley (slope = 0) for an arbitrary data set of XY values.
I've attached a pick of a sample set of data; probably helps clear up what I'm trying to do.
As shown in the pic, I'd like to extract the valley value pairs (e.g. 21.1925, 0.420687 & 24.4725, 0.420651)
I've tried taking the derivative but it only yields one of the values....always have at least two solutions.
tried working with a polynomial interpolation adn that went south quickly...no idea what happened there.
Anyway if you have a suggestion I'd appreciate it
best
SS
Solved! Go to Solution.
04-24-2009 04:59 AM
04-24-2009 05:39 AM
If you take the gradient of your data, as suggested by Coq rouge, then you want to be looking for regions where the polarity of the gradient switches from positive to negative (for local maxima) or negative to positive (for local minima). This would be better than looking the values themselves, because, as Coq rouge identified, you are very unlikely to get gradients of 'zero', and if you were to include a range (say -0.01 to 0.01) then you won't find the true minima/maxima.
So, take your gradient (derivative) and pass it through a greater-than-zero comparator, resulting in an array of booleans. At each index where the booleans switch from false to true you have found a local minimum, and where they switch from true to false you have found a local maximum.
This is my theory anyway - I'm sure there's probably a better way if anyone has any more ideas?
04-24-2009 06:01 AM
04-24-2009 07:06 AM
04-27-2009 08:42 AM - edited 04-27-2009 08:43 AM
04-28-2009 02:10 AM
thanks for all the suggestions. I've tried implementing them but think that what I've arrived at isn't all that clean...think it could be simpler.
I've attached the VI (in Labview 8.0) so if you have any ideas I'd appreciate it the help.
best
SS
04-28-2009 04:43 AM - edited 04-28-2009 04:45 AM
I hope I do not end up in a Janet Jackson Super Bowl situation for showing this. But all kidding aside I why are you not trying the tip I gave you in my message dated 04-24-2009 01:01 PM. As I said with some tuning you should get the desired result. I tested it and it works fine see picture.
04-28-2009 05:07 AM
Better watch out foir the case where the "Valley" is not a valley but can still be considered a "point of inflexion". This arises when the gradient goes from positive -> approches zero -> goes positive again (Or -ve, -->0, -ve). Thus the differential AND the sign change before and after the point of inflection is needed
Craigc