LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Finding a "jump" from the graph data *complex*

Hello,

 

This is a complex task.

 

I attached a vi (LV 8.5) to demonstrate my dilemma.

 

I am plotting the data to XY Graph. My task is to find the point where the curve "jumps" and the point where the "jump" ends. It is easy to approximate where those points are: jump start x coordinate is about 4650 and jump end x coordinate is about 6000. But how could LV code does it? One thing I have tried is in the example.vi. While loop compares consecutive data samples and if current sample > previous sample +0.2 it increases the counter by 1. And if it is not, the counter is reinitialized back to 0. While loop ends when counter is >= 100 or time out happens. Now it finds the jump start to be at 4875. While loop for jump end searching is also incomplete.

 

Maybe this is not the most reliable way to do it. Any ideas? Smiley Indifferent

 

 I also tried to use linear fit.vi but you have to split the data into the 3 pieces (data before jump start, jump itself and data after jump end) and in that case you still have to know where jump start and jump end are.

 

BR,

Jick

0 Kudos
Message 1 of 11
(3,585 Views)

Let's try again...

 

0 Kudos
Message 2 of 11
(3,575 Views)

Jick,

 

I think you may have some trouble defining the boundaries of the jump because of the noise on the signal.  The 4650 point you call the starting point is definitely affected by the 2 cycle per 1000 motor pulse interference.  Similarly, does the jump end at ~5100 or 6000?  The dip at 5500 is very similar to the one at 9000.

 

I put together a simple split and threshold method which produces 4750 = start and 5074 = end.  I am looking at refining this with linear fits and intersections of lines.  If that works, I will post back later.

 

Lynn

0 Kudos
Message 3 of 11
(3,554 Views)

What about

 

1.  Filter the data (from both sides to cancel any delays caused by the filtering)

2.  Take the differential of the data

3.  Find location of peak (max value) of differential data

4.  Look on both sides for the adjacent zero crossings which determine the points where the slope changes direction

 

Cutoff for filter = 0.01, I get 4602 as start and 5135 as end. 

Cutoff for filter = 0.005, I get 4508 as start and 5241 as end.

 

Hard to tell what is data and what is noise.

Randall Pursley
0 Kudos
Message 4 of 11
(3,546 Views)

Here is a version with linear fits to the before, jump, and after array subsets.  The start and end locations are calculated from the slope and intercept outputs from the fit VIs using the mx+b equation for a straight line.

 

This finds the start at 4675 and the end at 5147.

 

Sorry the code gets a little messy at the lower right corner.  I did not take any time to clean it up.

 

Lynn

Message 5 of 11
(3,545 Views)

Here is what I tried to do.

Randall Pursley
Message 6 of 11
(3,533 Views)

Thanks guys,

 

I take a closer look tomorrow about what you have done.

 

The jump really ends at ~6000 and it should be found. The one at ~5100 is a periodical disturbance, possibly from the mechanics or from the product. Not sure yet. That should be somehow ignored by the code.

 

I added averaging method which filters the code pretty nicely. If it helps...

 

BR,

Jick

0 Kudos
Message 7 of 11
(3,522 Views)

What generates the jump?  What is the source of the variations in the horizontal portions of the data?

 

The reason for asking is that often a knowledge of the underlying mechanisms or a good model of the behavior can be helpful in defining the transitions between segments.  For example if the end of the jump is really at 6000, then a straight line model of the jump is not going to work very well because the data tilts toward the horizontal significantly between 5000 and 6000 compared to the data between 4600 and 5000.

 

Lynn

0 Kudos
Message 8 of 11
(3,509 Views)

The code calculates difference between ideal screw and screw with the small chance in spiral. When the spiral of a screw changes, you see the jump.

 

Tester mechanics creates most of the noise in the signal. Software should take care of the rest. In other words, jump's start and end have to be found.

 

I have no more data available at this point to do more tests with your code. I try to find out where really is the actual end of the jump. If the jump is at 6000 (in this case, with this data) codes should be changed somehow to ignore the "fake" end and continue to search next possible end.

 

 

BR,

Jick

0 Kudos
Message 9 of 11
(3,496 Views)

johnsold, y start doesn't fit to corresponding x start value in your example2.3. X start is 4675,12, y start should be about 14. Your code calculates 5,20465. Same to the ends.

 

Jick

0 Kudos
Message 10 of 11
(3,484 Views)