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.

DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

How to calculate knee point without using cursor

I don't remember the details exactly, but finding the local maximum is done by calculation the first derivative of the curve and then, withinn this new curve, searche for the maximum. That's standard math for evaluation functions.

Not sure whether this helps. Please feel free to post your data and describe your problem. That way you might get more detailed feedback on how to find the solution.

 

 

0 Kudos
Message 21 of 26
(1,997 Views)

Right after hitting the "send" button I remembered what was implemented in my first solution. The sensivity part was NOT implemented in the script. I figured that the sensitivity paramter in the original algorithm was used to cover the fact that there might be consecutive local maxima's because of the noise which typically comes with the data.

I had used a filter early in the process to smooth teh data. With that, I could ignore the sensitivity part and just use the first local maxima.

 

Andreas

0 Kudos
Message 22 of 26
(1,996 Views)

Hi Andreas,

 

     Thanks for your reply. I indeed did the knee detection that way. Following your suggestion about the problem I am trying to solve, I'm posting an example.  Basically I have a plot where I am trying to find the 2 most linear portions (before and after the knee) to then extract the respective slopes. The initial idea was to find the knee point, split the curve into 2 segments at the knee point (for which I thought the kneedle algorithm was pretty good) and then run a linear regression on the respective segments to find the portions with the most consistent highest r-square (like a piecewise regression). The respective slopes can then be extracted from the linear equation fitting these points. Do you think there are other more optimal ways of achieving this? I have attached an image of what I am looking to achieve and there is also an excel file of the data example with the first column being the x-axis and the 2nd column being the y-axis if you want to have a look and play :-).

 

      Thanks for your help!

 

Anoop.

Download All
0 Kudos
Message 23 of 26
(1,977 Views)

Hello Anoop,

 

I looked at your description and then at the data you provided. Your algorithm makes sense to me. I definitely don't have a better idea.

I tried to look at teh 2nd derivative of teh curve (after smoothing it) and the result is somewhat ambiguous. So again, looks like you have a good algorithm.

 

Andreas

0 Kudos
Message 24 of 26
(1,968 Views)

Hey I am using this script to calculate knee point WRT time and I was wondering if there is a way to calculate the knee point starting from the end of the time series.  Essentially in reverse a where t - time.size then working backwards to find the knee point.

Tim
0 Kudos
Message 25 of 26
(1,183 Views)

You have a useful and fascinating solution.  I would really like to see the VBScript behind this.  I'm open to any arrangement.  

0 Kudos
Message 26 of 26
(992 Views)