LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Help with a maths problem and detecting changes in a curve

Solved!
Go to solution

I am trying to detect when the output of my reading overshoots, drops back and then rises again.

example

IanLloyd_0-1730362560069.png

I have tried performing a differentiation and detecting the peaks, the expectation was that a bad curve (top graph) would show 2 peaks, which is what I got. However when running the good curve (bottom graph) through the same routine it found 5. I had to set the threshold low in the Peak Detector.vi to make it work for the first example but obviously this was too low for the good example.

 

I am thinking that this approach is not the correct one.

 

I think I need to detect that the curve is always rising in the first 50 samples (in the above the sample rate is every 0.5 seconds) There are so many curve fit Vis and it is above my ability level to know which one to use to achieve what I want.

Can any of you guys point me in the right direction please?

0 Kudos
Message 1 of 7
(256 Views)

Hi Ian,

 


@IanLloyd wrote:

I had to set the threshold low in the Peak Detector.vi to make it work for the first example but obviously this was too low for the good example.

 

I am thinking that this approach is not the correct one.


The approach might be ok, but (maybe) you need to adjust the parameters…

 


@IanLloyd wrote:

Can any of you guys point me in the right direction please?


Well, if you would provide some code with typical data embedded in controls we could help you even better…

 

(Please downconvert to LV2019 if you use a recent LabVIEW version.)

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 7
(237 Views)

Thanks for your reply

 

I have attached the code. It is just something I have been throwing bits at to try and get a result.

In the data 0 to 7 in the curve selector are bad data, anything above that is good data.

 

Any help is appreciated.

 

Could something as simple as using a loop and shift registers to compare against the previous reading get me what I want?

0 Kudos
Message 3 of 7
(225 Views)
Solution
Accepted by topic author IanLloyd

Hi 

The overshoot of your original curve occurs when the differential curve changes from positive to negative, not on the peak. 

 

The peak of the diferential curve gives the point where the original curve has the max increase (the angle of the linear curve that touches your original signal0. 

LVNinja_0-1730380608812.png

 

Message 4 of 7
(176 Views)

Thank you very much.

All I need to do is find a value below zero!

 

I have tried it out on my data and it all makes sense.

 

Just need to make my code production ready now.

0 Kudos
Message 5 of 7
(171 Views)

I went after it a slightly different way. I look for dips in the data. It works with the two data sets you provided.

Tim
GHSP
Message 6 of 7
(155 Views)

Thank you for taking the time to produce a solution.

I can see benefits but I think I will implement the first solution.

0 Kudos
Message 7 of 7
(145 Views)