LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How can I find the slopes of two different portions of my XY graph?

Hello,
 
Below are two images of the same waveform, the second obviosuly is just a zoomed-in portion. I am trying to find the slope of the two distinct parts of that graph. The problem being is the starting and ending points of each graph may change based on the product that is being processed. Can anyone help or offer suggestions? Thanks.
 
Dave
 
WAVEFORM
 
 
WAVEFORM ZOOMED
0 Kudos
Message 1 of 15
(4,552 Views)
Dave,

How do you define the two parts of the graph? Does a user select regions or do you want to do it automatically?

For example in your graphs the line curves somewhat between 22.8 and 22.5 inches. The endpoint chosen will make a difference in the result. Similarly between 19.5 and 19.0 the line curves making selection of an endpoint tricky.

Once you have defined the regions, several techniques may be used. There are regression VIs or you could use the two point equation of a line, etc.

Lynn
0 Kudos
Message 2 of 15
(4,541 Views)

That is where it gets tricky. We would like to do it automatically.

To give you some background, the curve that you see represents force vs. distance. The process is that of something being pushed over something else and we have different lengths of materials so the curves will start and end and different places depending on the length of the material.

0 Kudos
Message 3 of 15
(4,531 Views)
Is there anything you know about the system which will help decide (automatically) where the transition takes place? A trigger signal, a minimum or maximum distance?

From your graph I think I would use a threshhold to establish a starting point. Maybe something like 10% of the peak amplitude. If the second segment will always have a lower amplitude than the first, using the peak as an initial dividing point might work. Calculate the slope from a subset of the array between the starting point and the peak (maybe 10% to 90% of the segment). Similarly take a subset of the post peak segment which is also above the threshhold. For your posted graph the Start point would be 22.8, the Peak 19.3, and the End point is at 15.7. The slopes would be calculated from the data between 22.45 and 19.65 for the first segment and 18.94 to 16.06 for the second segment. A procedure like this could be automated. Its success will depend on how consistent the data is from run to run (at least as far as the shape of the curves).

Another approach would be to calculate the slope of every half inch section and look for significant changes. You could then piece together adjacent segments with similar enough slopes and recalculate for the entire segment to get a better representation of the overall slope.

Lynn
0 Kudos
Message 4 of 15
(4,517 Views)

Lynn,

The second segment will always have a lower amplitude than the first but one thing that is not entirely visible in the graphs that I sent you is that the end of the graph (around 15.25") is where the hydraulic pressure peaks because the ram has bottomed out. Is there a way to eliminate those values in my peak measurement so I can establish the first "peak" as a dividing point and take a slope measurement up to and after that "peak"?

Would it also be feasible to take the slope until it goes negative and then use that point? And if so, how would I go about doing that? I apologize but I am extremely new to LabView.

Thanks for all your help thus far, it is very appreciated.

Dave

0 Kudos
Message 5 of 15
(4,506 Views)
I would take the derivative of the measured curve (which produces the local slope at every point), and then take a histogram of the slopes to find the two "most probable" slopes. If you could upload a file with typical data (instead of the graphical representation) I would try to quickly assemble some code.

-Franz
0 Kudos
Message 6 of 15
(4,495 Views)
Dave,

Franz suggestion sounds reasonable.

As to the peak at the end: I had not noticed that. Since both the beginning and the end of the data are not too important to your measurments, I would use a threshhold and array subset procedure at the end to eliminate the spike, similar to what I suggested at the beginning of the data.

As Franz asked, please post some typical data. A tab-delimited text file or a VI with the data saved as default value in a control will work.

Lynn
0 Kudos
Message 7 of 15
(4,491 Views)
Here is the typical data that you asked for. Thank you again for your help.
 
0 Kudos
Message 8 of 15
(4,486 Views)
Dave,

This data seems very different from the graph you originally posted. Can you give us some clue as to what you want? Do you want slopes of the first or second plot? Identify the x-coordinates which represent the endpoints of the regions of interest.

Lynn
0 Kudos
Message 9 of 15
(4,475 Views)

Sorry about that. The waveform images that I posted have been inverted. And the data also shows a timestamp that isn't used. The "C" column of the data is the y-values and the "B" column is the x values. The plot should be very similar to the images from before.

I am looking for the slopes that we were speaking about in the images. The approximate x-coordinates in the data that I gave that I am interested in are between

23.102293,-0.015259 & 19.172382,2.360143 and between 19.172382,2.360143 & 15.694584,2.211619

Those are the approximate data ranges that I am interested in. I hope that helps. Below is also a link to the VI that I have started to analyze that data that we are getting. if that helps.

http://www.rit.edu/~dwv2280/Analyze.vi

 

0 Kudos
Message 10 of 15
(4,471 Views)