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

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 .

  • 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?

  • 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

  • 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)

  • 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.

  • I have several 20,000+ point scatter plots that I'd like to graph with a best fit. Whats the best way to do this?

    Since they're so large and occupy the same range of y values, I'm kind of reluctant to plot them one over another so a best fit line would, I think, be the most helpful in analysing the data. I'm not quite sure however how to go about this since the data can be random

    Well, here's a very primitive way to decimate the data without any fancy algorithm. For this particular case, it looks pretty good. Each loop makes the array 3x smaller, averaging 3 adjacent elements. 4 iterations seem to be perfect. (I have included your raw data in diagram constants).
    For a polynomial fit, the more complex the data, the higher the order polynomial is needed to describe it. If it is a simple "banana" (my example above) you're OK with an order of 2 (up to quadratic), if it is s-shaped, you need at least 3rd order, etc. I tried your data with much higher orders (up to 40!) and it did not work.
    LabVIEW Champion . Do more with less code and in less time .
    Attachments:
    Best_Fit2.vi ‏370 KB

  • Best fit lines for loops and sine waves

    I am trying to find a best fit line that will work for sine waves and loops (hysteresis loops). I can get the sine wave just fine, but when I switch to a hysteresis it just puts a line across the middle (I assume because of the 2 y values for every x). I am doing data acquisition that will take in both forms and graph them. I tried a polynomial fit and it doesn't work at least the way I implemented it and I tried a few others but it looks like they are all function based. Also, my y values are coming out of a Bessel filter. I don't think this would be affecting anything but I thought I would put it in here incase it does.
    Did I miss one that I haven't tried that works for my application?
    Thanks
    Patrick

    RiversDaddy wrote:
    ... currently I am doing it by looping and reducing the error towards zero to fit the amplitude and phase. (I know the frequency).  If this is what you are looking to do then I will help, or should I be doing things differently? All of the functions I have found to filter or extract tones seem to introduce a larger frequency of phase error than i get using this method, but am I missing something?
    "looping" is a bit vague. What is the actual algorithm to find better estimates (e.g. levenberg marquardt, etc.)
    What problems did you have with extract single tone. Can you show some data where the results from it are not good?
    LabVIEW Champion . Do more with less code and in less time .

  • Is it possible to show a best fit line

    i am plotting percent fructose V.S density and trying to do a best fit line. A connect the dots jagged line would not be appropreate. Is it possibleto do this?

    Short answer: No. Wait to see what the next version brings. The only real work-around is to add a data set using the same x values and new y values, predicted from the linear regression. You would then have to draw a line over the resulting plot points manually. Then, "hide" the extra data set by eliminating the data point fill and outline.
    Only help I can offer is to look in your Utilities folder for an app named "Grapher." It can do everything you ask (and then some) and also produces high quality graphs as well (which can be copied and pasted into other apps in a variety of formats). Best of all, it's free and you probably already have it. It plots both discrete data sets as well as true functions. And yes, it will do linear regressions (and power, exponential, polynomial, and "custom" ones as well).
    Unfortunately, iWork's charting abilities are best described as "laughably pathetic." In stead of revolutionizing the charting aspect of spreadsheets, Apple chose to follow in M$'s footsteps, aka the path of a sado-masochistic CPA or "the Excel way." In essence, Numbers is only capable of producing what I call "bin count" charts (as in pie charts, bar graphs, and line/area charts). The "scatterplots" Numbers produces are really a hacked version of bin count charts. As such, they are basically useless for real scientific/engineering/mathematic plots. In fact, it does them so badly, I'm surprised the "scatterplot" option even made the cut for the final release.
    Things that breaks/cripples Numbers' "scatterplot":
    • No control over range of axis. "Value Axis Format" controls don't function properly/always remain blank and there is only one set of values for both axis (just like a bin count chart, whose "x axis" has no real, numerical value; so, doesn't need any controls). And there is no way to lock the scale of the axis so, for example, 10 units on the x axis is the same physical distance as 10 units on the y axis.
    • Axis grid divisions are only allow to be integers between 1 and 10 (which only makes sense for a bin count plot).
    • No 3D, log, log-log, ln, ln-ln, cylindrical, or spherical plots.
    • No true function plots. And there is no way to connect points, it only plots discrete data sets.
    • No control of data point marker sizes, only the fill/outline color and outline thickness.
    • Chart legend gets it's text from the independant variable (aka x values) column title, not the dependant (y value) column title, like it should. (Something that only makes sense on a bin count chart, which usually only have one column of data per data set.)
    • Each data set must come from adjacent pairs of columns. (You can't have one set of x values for a table of multiple y values.)
    • No way to control the size of the plot area itself (only the overall size of the chart rectangular area, which includes the axis text). So you can't fake a line chart as an overlay over a scatterplot, there's no way to align them.
    • Only does linear regressions directly (and then you have to put it together from pieces). No exponential, log, ln, power, or polynomial fits.
    • Charting brings Numbers to it's knees as far as speed is concerned.
    • I haven't found a way to ADD a data set to chart, it always seems to replace the data already plotted (or am I missing something or fighting a bug?).
    Heck, there isn't even error bars on it's financial charts, so you can't even do a simple high-low-close stock price tracking, line chart. Other than that, it you want a 2 1/2D pie chart with wood grain texturing, Apple's got you covered!
    Scott
    P.S. Just in case those of you reading this think I'm an Apple/Numbers hater, you couldn't be more wrong. I'm a huge fan of Numbers and it has permanently bumped Excel off of my dock. (I just don't use it for charting.) I call'em like I see 'em. And Apple can't fix it if they don't know it's broken.

  • 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

Maybe you are looking for

  • Format of jar file

    i need to know format of jar file, from buffer's view. i.e. zip file is in format of structs: local_file_head, central_file_head etc (in c/c++ sense). jar file should have similar format (a set of structs), but i can't find any info about it. thx for

  • How to generate one invoice for a sales order with product returns

    Hi All, I have a sales order that has been delivered and goods issue posted. Now the customer returns some of the product and I generated a Return using VA01 - document type RE, generated a returns delivery and posted a goods return. I need to genera

  • Problem in embedding 2 swfs in a single html

    hi, i am currently embedding 2 different swfs in a single html file,but i'm having problems. i am trying to embed the other swf programatically using js, but i'm getting a script error.. i am also having problems in running it in other browsers becau

  • How to include Navigational attribute in the selection screen

    Hello All, Can any body please tell me how to include a navigational attribute in the selection screen in BEX?

  • Sequence of LDT'S  to run into the target system.

    Hi, As part of the migration project  we need to  move the  messages,cp,dd and etc which was downloaded from the source system to target system using FNDLOAD. Now i don't know in which sequence i need to run these downloaded LDT's to the target syste