11-04-2008 04:02 PM
Hello, I'm trying to fit the output of an XY graph which is (1-D Array of Cluster of 2 Elements(2x 1-D Array of Double[64-bit Real])). It seems like instead of having one array with two columns X,Y indexed persample number, I want to have a 1-D Array of Column Y , indexed by X. Any ideas?
Thanks.
Solved! Go to Solution.
11-04-2008 04:17 PM
Uncluster the 1-D array that is outputted.
Then, you will have two seperate 1-D arrays, one for x's and one for y's.
Then when you index the array, use the same index for both arrays to get the (x,y) point.
11-04-2008 04:19 PM
11-04-2008 04:21 PM - edited 11-04-2008 04:21 PM
If you are trying to fit the data to some curve,
split the array into the two arrays.
One of x's and one of y's.
Then use those arrays as inputs to the fit function.
11-05-2008 09:38 AM
I'm getting NaN on the slope and intercept outputs, is there a way to take the output of the XY Graph Local Variable feed it into the Curve Fitting VI and then add the fitted curve back into the XY graph? It seems like it does not like the Output of the Graph.
Thanks.
11-05-2008 01:55 PM - edited 11-05-2008 01:56 PM
Hi!
I noticed that the XYGraph in your program is a 1D Array of clusters. You can build an XY Graph that way or build it as a cluster of 1D Arrays. It makes a difference in a lot of applications that depend on how the data is treated. Using the 2nd type of XY Graph, I was able to get the fitting values, but with the 1st way (what you're using now) I also got NaN. See the attached picture. Can you change the type of data in your graph and get the fitting to work?
11-06-2008 05:20 PM - edited 11-06-2008 05:24 PM
lefterisa wrote:I'm getting NaN on the slope and intercept outputs, is there a way to take the output of the XY Graph Local Variable feed it into the Curve Fitting VI and then add the fitted curve back into the XY graph? It seems like it does not like the Output of the Graph.
Thanks.
I have not seen any of your data, it may not be linear. If it is not linear, dont try to look for a constant slope.
Instead, use a derivative function to find the changing slope (uh-oh, this brings back haunting days of calculus).
When I used a linear fit, I was just giving you an example. Use whatever function you think is necessary.
11-06-2008 05:36 PM - edited 11-06-2008 05:37 PM
lefterisa wrote:I'm getting NaN on the slope and intercept outputs, is there a way to take the output of the XY Graph Local Variable feed it into the Curve Fitting VI and then add the fitted curve back into the XY graph?
Please attach your VI and some typical data. Most likely one of your points is NaN, in which case the linear fit will fail of course.
You really have some misconceptions. An XY graph is a data sink, and not a data source and faking it with local variables just complicates things. 🙂
So what you should do it take the output from the xy express VI, remove the points containing NaN, do the linear fit, and send both to the same xy graph terminal. You only need to write to the graph once.
11-07-2008 12:01 PM
Is there a way to feed the data of an XY graph into a Curve Fit VI? The reason I'd like to do it this way is that the end user can rescale the Data on the XY Graph using the Tools Pallette and this modified Data set will be passed along with all the resized axis information, thus eliminating the need to resize the arrays and reading and writing to all the property nodes.
Thank you everybody for all your help.
11-07-2008 12:05 PM
Changing e.g. the scales on an xy graph will not modify the underlying data.
Please attach a simplified VI example containing typical data.