LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

plot extra line in xy graph

hello 

 

i have one data and i am ploting it in xy graph. Next step is to find a slop of the signal so for that i have to trace an extra line in xy graph so i need some help regarding this problem.

 

here i am atteching picture of my vi in which i want to trace a line that i have shown.

 

thanks hope you will help me to figure out this problem

Download All
0 Kudos
Message 1 of 18
(5,076 Views)

Hi hussey,

 

what's your problem?

1) Do you want to find the slope of the curve and draw lines after you calculated the parameters?

2) Do you want to draw lines in the graph and used that hand-drawn lines to calculate the slope?

 

1) There is a full math palette with lots of functions. Try for yourself...

2) I advise to use cursors in the graph. Enable 4 cursors and draw lines between 2 corresponding cursors. Draw lines by adding additional plots in the XY graph...

Best regards,
GerdW


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

hi

I want to draw lines in the graph and used that hand-drawn lines to calculate the slope.

thanks

0 Kudos
Message 3 of 18
(5,057 Views)

GerdW's advice on using 4 cursors is probably your best option.  Cursors are easy to utilize and the user will simply place them at the start/stop points for each line you wish to make.

 

Drawing on the graph with the mouse is a bit more difficult.  I'm not aware of a simple way to do this but here are some thoughts.  Using Mouse Down and Mouse Up events, you can get the mouse positions in pixels.  These locations then must be converted to pixel locations on the graph (subtract mouse position from graph position).  Then, you must convert the pixel values to corresponding XY values for your graph, base on the max/min values of the axes along with their relative positions from the graph indicator's corner.  After all of this, you'd finally have the start/stop XY positions for a single line.  Then you still have to run code to create a line from those points

 

As you can see this would be very complicated compared to simply placing 4 cursors and clicking a button to generate 2 lines and add them to the graph.

0 Kudos
Message 4 of 18
(5,033 Views)

hi

 

thanks for reply

 

putting for cursor i can't get exact location of the slope.

so could you suggest any other technique or can any body modify my vi.

because i know this is most challanging part of the vi to take a slop using curve fitting method.

 

please any body help is required for this things.

0 Kudos
Message 5 of 18
(4,985 Views)

The real details again go back in to exactly what you want to happen.  But, the simplest way to determine slope is to use the Cursor Position property node to get the XY position of each cursor.  Using the first two cursors (left most on graph), calulate the slope.    To add the lines to the graph, you can use the slope & a known point to calculate the y intercept.  You now have y=mx+b and can calculate a line of points between the two cursors.  Add this new XY pair to the graph.

 

Nother option, is to try and determine the index associated with each cursor.  Then use the Array subset vi to extract the section of data between the cursors and feed this in to the linear fit vi

 

 

0 Kudos
Message 6 of 18
(4,969 Views)

hello

thanks for reply  but still strugling with this problem. can any one impliment it.

 

thanks

0 Kudos
Message 7 of 18
(4,921 Views)

Why do it manually?

 

Follow your points along, keep a running calculation of the slope and goodness of fit for a straight line [you could use the "Linear Fit Coefficients" VI for slope and residue] for a set number of consecutive points ( 5? I don't know how dense your data is, but less than this you're in trouble. 10 would be better).

 

After your slope and residue both go up (indicating your first inflection point) and before your slope goes back down (second inflection point), determine the segment which has the best goodness of fit (least residue), This is your first line.

 

Do the same before the slope increases again (third inflection point). This is your second line.

 

Using the data (slope, intercept) from your fitted lines, determine where your lines intersect.

 

That's all there is to it.

 

Of course, it'll be harder the more noise is in the signal.

 

Cameron

 

 

To err is human, but to really foul it up requires a computer.
The optimist believes we are in the best of all possible worlds - the pessimist fears this is true.
Profanity is the one language all programmers know best.
An expert is someone who has made all the possible mistakes.

To learn something about LabVIEW at no extra cost, work the online LabVIEW tutorial(s):

LabVIEW Unit 1 - Getting Started</ a>
Learn to Use LabVIEW with MyDAQ</ a>
0 Kudos
Message 8 of 18
(4,904 Views)

hello 

thanks for reply camerond

 

can you impliment this sugesstion in given vi which is atteched first.

 

 

thanks

0 Kudos
Message 9 of 18
(4,890 Views)

What have you done? There are no attachments except the ones to the original post, which I can't even run because a subVI is missing. You've gotten several suggestions which should be very helpful if you still want to do things manually.

 

Cameron

 

To err is human, but to really foul it up requires a computer.
The optimist believes we are in the best of all possible worlds - the pessimist fears this is true.
Profanity is the one language all programmers know best.
An expert is someone who has made all the possible mistakes.

To learn something about LabVIEW at no extra cost, work the online LabVIEW tutorial(s):

LabVIEW Unit 1 - Getting Started</ a>
Learn to Use LabVIEW with MyDAQ</ a>
0 Kudos
Message 10 of 18
(4,874 Views)