From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

Chicago LabVIEW User Group

cancel
Showing results for 
Search instead for 
Did you mean: 

Help with an Algorithm

Hi Everyone.  I'm not sure if this is really the most appropriate place to ask this but I figured I'd ask locally first. 

 

I'm trying to come up with a simple algorithm to select 2 points from a data set to be used for a baseline correction. Initially the points were being selected visually by the user picking the points out on a graph, but this has proven to give inconsistent results because everyone picks different points out of the data.  The idea is to pick the lowest points before the data is 5% of the maximum, and then the lowest point after the data returns to 5% of the maximum.  BUT..... sometimes the data has multiple peaks, and looks like a rollercoaster, and the lowest point after the maximum could be halfway through the data set and a great portion of the data would be cut off. 

 

Selecting the first point is pretty straightforward and I have that nailed down.  The second point is where I'm looking for some input from folks who know more than me.

 

My thought is to reverse the array and find the lowest point before the data starts to rise above that 5% mark, but if anyone has a simpler idea I'm happy to hear it.

 

I'm attaching a PDF of a graph as an example of what I'm dealing with.  I wasn't given the raw data to work with. 

https://www.youracclaim.com/badges/7af733bc-832f-47fe-aaa6-9df19dddd73b/public_url
0 Kudos
Message 1 of 3
(1,846 Views)

It's not obvious to me what the requirements are, and the 5% of max bit seems to over complicate things.

 

Find the max value, split the graph in half at that point. Find the min value of each data set. If that min value is greater than 5% of the max value, then no valid min value found. Otherwise you're done?

 

I'd suggest drawing out some sample data sets and walking through how you would do it by hand, then translate that into logical rules.

 

The before and after max value points seem to follow the same rules, so if you can find the min before, then reversing the data and using the same logic should find the min after. Unless there are assumptions about the data, such as the first peak is always the highest, which you are taking into account. Good luck

0 Kudos
Message 2 of 3
(1,815 Views)

It would probably help to attach a simple VI containing a problematic dataset.

0 Kudos
Message 3 of 3
(1,806 Views)