General Polynomial Fit

I need to fit a polynomial function and extract the coefficients a0, a1, etc, of my data. But in the General Polynomial Fit i have to especified the order, is there any way to find automatically the polynomial order and then extract the coefficients? Thank you.

Thinking about this question again, I`m not sure I`ve answered the correct question at all.
My original method (Scanning different fit orders) will give aou an N-order Polynomial which fits the signal well, but the assumption that your signal is then also an N-order Polynomial is generally false. If you are simply looking for a polynomial which well describes your signal, this is OK.
If you are dealing with simple clean signals then you MIGHT be able to make assumptions on the signal type based on various fit coefficients, but if you`re trying to understand fundamentals of a real-world complex signal based on fit-algorithm errors, I would be, in addition to the other respondants, very cautious. I`m not a very good mathmatecian (I love that the fit algorith
ms simply ), so I can`t begin to give a hint as to do this kind of analysis.
Shane.
Using LV 6.1 and 8.2.1 on W2k (SP4) and WXP (SP2)

Similar Messages

  • Different general polynomial fit results

    Hello,
    I've encountered a strange problem using the general polynomial fit: It seems that the outcome of this vi is computer dependent...
    I'm using labview 8.2.1, and tried to use the vi to get a polynomial fit (with an order between 12 and 20) on about 450 datapoints, which seemed to work fine... until I shared my vi with another person, where different results for the polynomial coefficients were obtained with the same datapoints (and the same parameter settings). I noticed that the differences get bigger when the requested order increases.
     has anybody encountered a similar problem?
    greetings,
    Hans
    Attachments:
    get_polyline.vi ‏37 KB

    Well, taking a 20th order polynomial does not make a lot of sense anyway. What are you trying to achieve? There are probably better ways to do whatever you want to do here. You are dealing with extreme intermediary values (e.g. 1500^20=3.32e+63) so a slight reordering in operation could change the outcome.
    Can you explain the differences between the computers? Is the other a different OS (e.g. mac vs windows)? Just curious.
    LabVIEW Champion . Do more with less code and in less time .

  • How to use General Polynomial Fit

    Hey,
    Very new to LabVIEW (mostly use Matlab) and I'm trying to use the General Polynomial Fit VI and I have found the built-in help for LabVIEW very lacking and the examples not much better. The help says that, among other things, the inputs are the x and y data points. I have my data in 1D arrays of double, but this is apparently the wrong format for the VI it states that the VI needs it in double. This would imply that it only takes one data point at at time? Do you have to build it up one point at a time in a loop?
    Thanks in advance for any help,
    dnorman

    Oops, nevermind. Accidentally selected the point by point variation...

  • "Residue" in General Polynomial Fit Function

    Do any of you statistics wonks understand how LabVIEW calculates the "residue" output in the "General Polynomial Fit" function?  How does it relate to the R^2 value on an Excel polynomial trendline.
    I've been trying to figure this out for hours, but the LV help files don't seem to have the info I am looking for, and I cannot find a good explanation on line.
    Thanks,
    FB
    Solved!
    Go to Solution.

    I figured it out.  I was looking at the TOTAL error of all elements, rather than the average error.

  • Using General Polynomial Fit VI with waveform graph

    Hello gurus ,
    I would like to ask how to use General Polynomial Fit VI with waveform graph not GraphXY .
    Waveform graph is giving me an array of values not X , Y i think , what should i do ?
    Thanks in advance
    Solved!
    Go to Solution.

    Hi Omar,
    i changed the shipped Labview Example to use the General Polynomial Fit VI with a waveform graph.
    But why don't you want to use a X-Y-Graph?
    Regards
    DianaS
    Attachments:
    test.vi ‏37 KB

  • 2-dimensional polynomial fit

    I want to do a 2-dimensional polynomial fit. How can I do this is LabVIEW or LabVIEW/IMAQ ?
    Marc

    I am not sure what kind of polynomial fit you want to do. LabVIEW offers a generalized least squares VIs for calculating the surface that minimizes the distance to all the data points. Can you explain what you want to do better?
    Jeremy

  • Polynomial fitting for scatter plot

    Hi all, 
    I was wondering if there is any way to generate a polynomial fit to a scatter plot just like in excel. The data I am trying to fit has several y values for each x value. 
    Thanks
    Krish
    Solved!
    Go to Solution.

    Well, my "solution" above is a bit misleading, because the polynomial fit of course does NOT depend on the x ordering. If the x-values are scranbled as in your case, a maybe better solution would be to simply create a linear x-ramp over the data range and use polynomial evaluation to calculate a smooth best fit line. This has also the advantage tha a smooth curve is generated even if the data points are sometimes far apart.
    Here is one possible modification to show the technique.
    LabVIEW Champion . Do more with less code and in less time .
    Attachments:
    Scatterplot_fitting_MODCA2.vi ‏13 KB

  • Chebychev Polynomial fitting results show multi lines

    I am using "nonliear curve fit.vi" with defined Chebychev Polynomial  function to fit XY data.  Strangely, if I enlarge the upturn part, I clearly see the fitting results show multi-lines (2-4) . Please the the attached snapshot.
    weitong
    LV2013
    Attachments:
    chebychev Ploynomial fit.PNG ‏48 KB
    chebychev Ploynomial fit-whole.PNG ‏19 KB

    Thanks.
     I found the reason: the data X values are not mononicaly, i. e.  there are local oscillations at some region.
    After sorting the raw data, the fitting results show single line. 
    Is the sorting of X values necessary before Chebychev Polynomial fitting?

  • I need a curve fitting algorithim for polynomial fits, very compact for Fieldpoint implementation (can't use prebuilt VIs).

    I can't use the prebuilt VIs because the libraries take up too much memory on my FP-2000s.  Anyone built up a polynomial fit VI that doesn't include the LV libraries or dlls? 
    Thanks,
    Bill
    Solved!
    Go to Solution.

    Hey Bill,
    That puts you to about 21-22Mb MAX. Doesn't it fit?
    It seems like you may want to look into a controller with larger memory, such as the 2010/2015 or the newer compact FieldPoint controllers.
    Aashish M
    Applications Engineer
    National Instruments
    http://www.ni.com/support/

  • How do i find where 2 best fit lines cross?

    Hi
    I was wondering if anyone knows a way to find where 2 best fit lines cross, I don't have the equation for the lines and i'm not sure if I can get it.
    I currently have the program tracing the lines and comparing y values however it will only increment in steps of 0.1 on the x-axis and i need an accuraccy of 0.0001

    If you have or can get a series of XY value pairs for both of the lines, getting the equation of the line is as simple as calling Linear Fit.vi.  Once you have the equations of both lines, the intersection is simple algebra, subject to the accuracy of your fit.  If the XY data pairs describe a curve, not a line, and you want more accuracy, you can try a polynomial fit using General Polynomial Fit.vi.  To find the intersection, set one polynomial equation equal to the other, compute the coefficients of the resulting polynomial equation, and find the root using Polynomial Roots.vi.  All this assumes you have a Pro or better version of LabVIEW.  If you don't, you can still do it, but you will need to write some code for the fits and roots.  Check out a copy of Numerical Recipes in C, by Press et. al. from your local library and it will give you the equations for all the above.  With LabVIEW's native matrix handling capabilities, the rest is straighforward.
    Let us know if you need more help.
    This account is no longer active. Contact ShadesOfGray for current posts and information.

  • Curve fitting gives input, at the output

    Hi everybody, i am having a problem at curve fitting function,
    i take at output, what i give as input, where do i make mistake?
    at example i give 4 values, if i enter 6 values it works, but i need to do it with 4 values.
    any ideas?
    thanks
    Solved!
    Go to Solution.
    Attachments:
    curve fitting.vi ‏16 KB

    Your function is a simple quadratic polynomial, so you should use the general polynomial fit function instead. Don't overcomplicate things
    LabVIEW Champion . Do more with less code and in less time .

  • What order of polynomial in "polynomia​l interpolat​ion.vi"?

    How to set the order of the polynomial in this distributed vi in LV5.0?
    I tested it with value arrays for [X] and [Y] (100 points each),
    and with x values inside the range of [X],
    getting error -20050 (pole) all the time. It is not clear what order
    of polynomials is used inside the vi (in code form).
    Any thing out that is better than this one?
    Thank you.

    I think that the order of the polynomial is equal to the size of the input [X] and [Y] arrays. I'm no expert in this area, but apparently the Polynomial Fit VI uses Neville's algorithm as outlined here in the popular Numerical Recipes in C reference (I was pointed here from an NI KnowledgeBase entry):
    http://www.ulib.org/webRoot/Books/Numerical_Recipe​s/bookcpdf/c3-1.pdf
    Apparently, the problem is arising because your [X] and [Y] inputs, when fed through the algorithm, are resulting in something insoluble. I can get error -20049, for instance, when I feed in an X array with two consecutive elements of the same value. I think the reason for this is clear if you look at equation 3.1.3 in the reference link above (divide by zero).
    Anyway, I doubt that you rea
    lly want a 100th order polynomial fit just to interpolate your data, correct? You might just want to use General Polynomial Fit.vi, get a fit with your desired order, then plug your desired X value back into the result to get your interpolation.
    Hope it helps,
    John Lum
    National Instruments

  • Creating Trendline of 50 Period Moving Average

    HI, im trying to plot my graph in LabView and trying to do create a treadline of 50 period moving average like in excel.
    is it possible for me to do it in LabView?
    i have tried General Polynomial Fit VI and some other VIs in Fittings but cant get anything close to the way i want
    any ideas? anyone?
    Solved!
    Go to Solution.

    Charlie, There's a better VI called "Mean PtByPt". Look in the palette "Signal Processing >> Point by Point >> Prob & Stat >> Mean". One added benefit: this VI gives valid data for the first 50 points, even though the mean is not "fully developed" or "stabilized" during the first iterations. (Also, keep in mind that "Delete from Array" and "Build Array" primitives make a call to the memory manager, meaning memory copies for large arrays and fast loop rates will result in a CPU bottleneck. Using circular buffers is one way to mitigate this limitation.)
    64864050, try adapting this code to fit your needs:
    a.lia-user-name-link[href="/t5/user/viewprofilepage/user-id/88938"] {color: black;} a.lia-user-name-link[href="/t5/user/viewprofilepage/user-id/88938"]:after {content: '';} .jrd-sig {height: 80px; overflow: visible;} .jrd-sig-deploy {float:left; opacity:0.2;} .jrd-sig-img {float:right; opacity:0.2;} .jrd-sig-img:hover {opacity:0.8;} .jrd-sig-deploy:hover {opacity:0.8;}

  • Problem with interpolation

    I've got a problem. In my VI there are three different kinds of interpolation. Fpr ma the best interpolation is the Rat.-Interpolation.
    But in this Interpolation there are extreme errors. Why?
    I need an Interpolation which gives me a
    x- and y- value back.
    Attachments:
    Kennlinie_Interp_Motor.vi ‏434 KB

    Hi Markus,
    when you use to interpolation function y = a + b * x as in "General Polynomial Fit.vi" with 'polynomal order' = 2 . You must recalculate you require X values over this function.
    Or when you want use complicated polynomial {or other } function you can use Formula Node. Look my second part of example. It looking terribly, but it working, and you can use complicated interpolation function.
    Have nice day
    JCC
    Attachments:
    compare_Interp_2.vi ‏101 KB

  • How to Simulate The Excel LINEST Function in LabVIEW

    This may be a dummy question but I’m pressed for time.  I have used the Linear Fit.vi function to duplicate the Excel LINEST function and it works great.  However, the engineers here want to set the LINEST const option to FALSE.  How can I duplicate this option using LabVIEW?  I’m using LV v.8.5.1.
    Solved!
    Go to Solution.

    Hi Darin,
      Your suggestion to use the General Polynomial Fit.vi lead me in the right direction.  I am able to duplicate the “const” option within the Excel LINEST function by using this vi.  Your response is much appreciated because it saved me considerable time.  Attached is a modified version of the Regressions Demo.vi that was available in LV help.  It shows how the “const” option makes a difference in the linear slope.
      Thanks again,
      Dave J.
    Attachments:
    Regressions Demo for TS1.vi ‏33 KB

Maybe you are looking for

  • How do I either link two Address Book cards or have one card for two people

    I have a husband and wife I need to put in my Address Book, Joe and Jane Smith. If I create a card for Joe Smith, then list both their email addresses, whenever I want to send an email to Jane, the address comes up showing HIS name: Joe Smith <[email

  • Input/output sound for MacBook Pro 10.6.8

    The sound is not working properly for my narrated powerpoint presentation. I have recorded it on my MacBook Pro 10.6.8 and I get some sound but it sounds like feedback or something (like a scary phantom voice). I am using the internal microphone and

  • Animation freezes (I think because the script is Flash 6 and my doc is CS3) ???

    I have an animation script for particles that was created in Flash 6. I'm trying to recreate it in my flash document that is setup as Flash 8. I couldn't get the animation to play and then I figured out that if I go back to this original Flash 6 docu

  • Still can't connect with PC

    Well, at this point I've spent at least 15 hours trying to troubleshoot why I can't connect in iChat with my daughter on her XP machine, and still no luck. I've read a lot of the threads here, but nothing mentioned seems to work. I have a Mini mac ru

  • Why won't my camcorder import to my iPad 2?

    I have a Toshiba Camileo H30and when I plug the memory card or USB cord into my iPad 2 through my camera connection kit the videos say they imported but but when I touch them all there is is a white page with a picture of a video camera. Please Help