08-23-2013 03:55 AM
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
08-23-2013 04:26 AM
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...
08-23-2013 04:58 AM
hi
I want to draw lines in the graph and used that hand-drawn lines to calculate the slope.
thanks
08-23-2013 09:16 AM
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.
08-25-2013 11:26 PM
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.
08-26-2013 09:22 AM
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
09-03-2013 05:34 AM
hello
thanks for reply but still strugling with this problem. can any one impliment it.
thanks
09-03-2013 01:39 PM
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
09-03-2013 11:00 PM
hello
thanks for reply camerond
can you impliment this sugesstion in given vi which is atteched first.
thanks
09-04-2013 07:12 AM
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