LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Creating Coefficients from fitting

I was wondering if Labview has the capability to create the coefficients to an equation in the form of Ax3 + Ax2 + Ax + B if just given a dataset like the attached. I'm looking for something like if in Excel where you right click on the graph and add trendline. You can then display the equation.

 

I've tried the general fit vis in the fitting folder but they don't reproduce the waveform as well as the cubic spline. But then the spline just gives me back the data I input into it which is useless, IMO. If there is no way to get an equation from LV, is there a way to increase the dataset on the output of the cubic spline vi? I feed in 25 data points and I get back out 25 datapoints. Is there a way to get out 200 datapoints? I'm trying to interpolate the values between the datapoints that I feed it. Or is there a better/different way to accomplish what I'm trying to do?

Download All
0 Kudos
Message 1 of 4
(2,421 Views)

First, your data does not look like a very good match to a quadratic curve.  A 4th order polynomial fits a little better until you get close to the ends of the data where the fitted curve takes off.

 

Fits only work as well as the model or equation matches the data.

 

Did you look at the General Polynomial Fit.vi in the Mathematics >> Fitting palette?  It returns the coefficients as well as data fitted to the input X Array.  You can then use the Polynomial Evaluation.vi to plot the equation over as many points as you wish. 

 

An XY graph seems like a better choice than the waveform graph because your X values are not uniformly spaced.  This also makes it more obvious that your data is not polynomial.

 

Lynn

0 Kudos
Message 2 of 4
(2,409 Views)

I'm just amazed with the functionality of LabView. The more you dig, the more stuff you find. It isn't exactly what I wanted, but it is close enough. And if someone is looking at this in the future I would paste the solution I found.

 

 Pond.PNG

 

Don't know if anyone wants to answer this, but how do you insert code into a post? I try to copy the code (CTRL-C from LV) and using the "Insert Code" button, but I can't paste the code into the pop-up. CTRL-V doesn't do anything and even when I try to right click, paste is grayed out. But I can paste the code in paint/word, etc. Smiley Frustrated

0 Kudos
Message 3 of 4
(2,386 Views)

Digging can be fun!  The search tool sometimes is helpful also.

 

Do not use Insert Code from the toolbar.  Look below the text box where it says "Attachments".  Below that is a button marked "Choose File".  Pressing this button will bring up a file dialog which allows you to select the file you wish to attach.  If your VI has subVIs which are not from LabVIEW's vi.lib, then zip those together with the main VI before attaching.

 

Lynn

0 Kudos
Message 4 of 4
(2,380 Views)