Linear Regression or Curve Fitting?

Hi,
I would like to perform linear regression operation over some data that I have collected during test. What is the difference between linear regression and curve fitting? Can I use curve fitting VIs available to perform linear regression? If no, where can I find VIs or information regarding linear regression in the LabVIEW 6i?
Thank you for your help. It will save me many hours of search.

there are some very good examples in the examples directory of LV. C:\Program Files\National Instruments\LabVIEW 6\examples\Analysis\regressn.llb\Regressions Demo for example. You must have a LabVIEW full development system.
Stu

Similar Messages

  • Why doesn't my non-linear curve fit finish?

    I am working with an experiment that gives me X- and Y- data that I need to fit to a theoretical model (somewhat involved). I use to do this in matlab using the "lsqcurvefit", which works fine,
    but for varous reasons I need to do this in LabView instead.
    So, first thing I did was to make a vi which is my theoretical model. I throw in my X-data and get the Y data out of it.
    This vi works fine of it's own, but now I want to do my fitting by calling the model-vi from the Nonlinear curve fit.vi. I enter the same initial parameters, termination conditions, upper- and lower boundaries as in the matlab code, but no matter what, after some 100 function calls, the curve fit interrupts and tells me:
    "Error -20041 occurred at NI_Gmath.lvlib:Nonlinear Curve Fit LM.vi
    Possible reason(s):
    Analysis:  The system of equations cannot be solved because the input matrix is singular."
    I have tried to locate the problem at varoious levels but I get confused when I start to look into the nonlinear curve fit vi, I just lose myself in tons of block-diagrams.. Can anyone see what my problem is? I'd sure appreciate it! I added the necessary files. Main vi: langevin fit. vi, then open the data.txt.
    Thanks
    Attachments:
    langevin fit.zip ‏94 KB

    Your model function does not produce anything resembling your data. As a first step, graph the data using your initial guesses, here's how it would look.
    Here' the data and your initial guess on the same graph. You need to find initial guesses so the output resembles your data.
    My best guess is that your model is faulty. It is very hard to debug, because it is a mess: deeply stacked sequence structures and unneeded local variables. Also the model parameter constants should be provided via the "data variant" input instead of a global variable. You have a weird mix of datatypes. Why is half of the stuff EXT instead of DBL for no reason?
    I would also highly advise NOT to color your own VIs light yellow. Don't make them look like system tools!
    I am busy today, but maybe I can have a stab at it tonight. Good luck!
    Message Edited by altenbach on 07-06-2009 08:59 AM
    LabVIEW Champion . Do more with less code and in less time .
    Attachments:
    langevinFit.png ‏21 KB

  • How to implement Non linear Curve fitting (lsqcurvefit of matlab) in Labview

    Hi Labview Team,
    I am looking a way to implement "lsqcurvefit" command of matlab in Labview to do some curve fitting ; basically to  Solve nonlinear curve-fitting (data-fitting) problems in least-squares sense, at present I couldn't find a better way to implement it. Can you please give me some suggestion on this to how to implement this " curve-fitting: on labview.
    Thanks,
    Ankit Gupta

    You did not say you have the mathscript module. Do you? In any case, labview has a rich set of native nonlinear fitting tools. This seems like a better option.
    LabVIEW Champion . Do more with less code and in less time .

  • Linear Regression - set intercept = 0?

    Using a linear regression, is there a way to set the intercept to zero?

    This annoyed me for a short while when I first started using Diadem.
    Instead of trying to run a linear regression, you can use non linear curve fitting and change your setup function formula from a+b*x to simply b*x (or similar). This ensures that your fit intercept is 0.
    CLD

  • How can I apply curve fitting to simple BER measurement data?

    I am collecting simple BER data from a communications receiver for modulations such as PSK, CPM, etc. The data looks good but has the usual measurement noise, which I would like to spiffy-up for customer presentations.
    I have tried virtually all of the vi's in the LV Fitting palette, with little or no success. One of the NI AE's provided me with a GP Fit approach, but it has problems when you introduce error. I have attached a vi which demonstrates this, and also shows an attempt on my part to use the Least squares vi, with various functional estimates of the erfc vi. The vi also includes sample data.
    I see MatLab (and possibly Wolfram) has a function specifically for BER smoothing, but NI doesn't, as best I can tell. I feel certain that one or more of the LV fitting vi's can be coerced into working with the correct parameters - but so far I can't find them!
    Has anyone tackled this problem with good results?
    One other thing - has anyone else noticed that the formula used by the LV erfc (complementary error function) is *not* the standard model used for BER/radio communications applications?
    Appendix B of Digital Communications by B. Sklar gives the conversion:
    Q(x) = 1/2 erfc (x/sqrt(2)), where erfc (x) is the LabView vi block.
    Thanks,
    Mark

    Hi Eric,
    Well, BER is just data measured at certain input levels to a receiver. For digital communications systems, we typically use Eb/No to specify the input signal strength, and measure the BER at that level. This is analagous to signal-to-noise ratio (SNR) measurements in the analog domain.
    The BER values tend to run from between .01 and 10E-5, or even 10E-9 for high performance systems. As a result of the wide range of BER values, it is usually plotted on a logarithmic (y-axis) scale. Values of Eb/No are in the range of a few dB, up to perhaps 15~20 dB. So the x-axis is normally 'linear', although in dB.
    I have attached the vi's again, and if you run the LS BER fit vi, you will see the data plotted. If you turn off the noise, you can see a very nice plot - the curve fit vi works fine. But if you add noise (which simulates what you would measure in a real system), and run it several times, you will see all kinds of responses - depending on the noise parameters. What I am looking for is something that gives me a nice smooth graph even with the noise turned on (which is what my real data looks like).
    Thank you,
    Mark

  • Curve Fitting

    Hi 
    I have a set of measurement data that i wish to fit to a complex curve.
    After the fitting i need to find the constants from the curve and use them for further calculations.
    equation for my curve is 
    x= -a* integral(p^n dt) + c.,
    where x,p are known data sets at time t. 'a' and 'n' and 'c' are constants. after the fitting i have to find best values for a and n.
    somebody please explain how i can accomplish this.
    Waiting For the inner calling

    Inorder to use the  Levenberg-Marquart method, it is neccessary to specify the formulae string. but how can i specify a formula containing integral function as a labview string.
    Warm regards
    Deepu Jacob
    DFGray wrote:
    You have two main options:
    Convert the integral to an actual equation, then use a non-linear fitting routine, such as the Levenberg-Marquart, to do your fit. You will need approximate values for your parameters before you start.
    Use one of LabVIEW's numeric integrators to do your integral, and use a non-linear fitting routine to find the parameters. This will be slower.
    Before you go any further, I would strongly recommend you read the chapters in Numerical Recipes, 10 and 15, about fitting data to parameters. Nonlinear curve fitting can be very finicky, so you need to know what you are doing. LabVIEW has all the algorithms (if you have a student, full, or pro version), so you won't have to code much more than your actual function.
    Good luck! Let us know if you run into problems.
    Waiting For the inner calling

  • Gaussian Peak Fit and Nonlinear Curve Fit on small data differ from Origin Peak fit

    Hi all,
    I am developing a program in which I have to fit Gaussian curve on only 4 or 5 data points. When I am using Gaussian Peak Fit or Nonlinear Curve fit, it linearly connects all the points while other fitting software like Origin is fitting Gaussian curve on the same set of data I have attached two images One is from Labview with Gaussian Peak Fit and NonLinear Fit and other is from Origin.
    Data is
    X                       Y
    799.09857        257
    912.25256        641
    1026.00366     1516
    1137.92871     1118
    1253.43713     329
    Labview user
    Solved!
    Go to Solution.
    Attachments:
    Origin_Fit.PNG ‏21 KB
    Labview_fit.PNG ‏15 KB

    That looks like a plot of the input data.
    When I run it with your data I get a Gaussian curve which looks much like your Origin plot.
    The Plot 2 curve is from 128 points equally spaced along X and Y calculated from the Gaussian formula in the LV help using the output parameters from the fit.  Plot 1 is the Best Gaussian Fit output from the fit VI.  It only has five points.
    I used default values for everything except X and Y.
    Lynn

  • Curve fitting only part of a waveform

    I am taking some data from an Oscilloscope and I need to do a curve fit.  As you can see from the data in the attachment the data begins at 0 and ends a 10e-6.  I just want to curve fit the part from 5e-6 to 10e-6.   This is what I have tried
    1) I take the waveform and use a "Get Waveform Components".  I then take the Y data and strip off the first half of the data from the array.  Then I  use a "Build Waveform" and put in the new Y data and the dt data to make the NEW waveform.  I then put it in to the Curve Fitting Express VI.  This works well for the slope, but of course the intercept is off because the data that was at 5e-6 is now at 0.  And the data at 10e-6 is now at 5e-6 since I stripped off the first 5e-6 of data and rebuilt the waveform.   I thought I could use the "t0" value in the "Build Waveform" to set the start of the NEW waveform to be 5e-6, but it seems that the "t0" is only for a timestamp (its a calendar data). 
    2) I thought about converting the waveform in to X and Y data because it would be easy to shift the X data by just adding 5e-6 to each value in the X array.  But then it wouldn't input to the Curve Fitting Express VI. 
    3) I thought about using the "Locations" input to the Curve Fitting Express VI, but I haven't really been able to get that to work. 
    Thanks for any help. 
    Solved!
    Go to Solution.
    Attachments:
    graph.jpg ‏128 KB

    Hello,
    Check out these examples and online docs relating to curve fitting. Perhaps they will be of some use.
     5th-order Curve Fitting Using Curve Fitting Express VI
    Linear Curve Fitting a Random Waveform Graph
    Overview of Curve Fitting Models and Methods in LabVIEW
    Introduction to Curve Fitting
    Best,
    National Instruments
    Applications Engineer

  • How can I make a graphic (scatter chart) with 1 "y", but multiple "x" (to make a multiple linear regression)?

    how can I make a graphic (scatter chart) with 1 "y", but multiple "x" (to make a multiple linear regression)?

    Émilie,
    The default for X-Y Charts is for X values not to be shared, so it's entirely possible for you to create X-Y pair sets that have common Y-values and independent X-values.
    This answer assumes, as always, that I properly interpreted your problem statement. A linear fit line for each pair set should satisfy.
    Jerry

  • Curve fitting sin*Exp

    Hi,
    I have a few questions,
    1- Can I put my initial guesses to the `curve fitting express` via an array control instead of editing each time the express itself?
    2- I have trouble with the fitting of my signal. it`s far beyond my initial guesses. I tried playing with the numbers and it seems when I put the right numbers in the function instead of using the parameters, the fitting is perfect, but when I put the same numbers as initial guesses I don`t get even close to data fitting, instead I get most of my signal as a residual.can someone help?
    3- the fitting itself takes ages, is there any way to make it faster?
    SubVI, and the text data file attached.
    thanks.
    Attachments:
    Untitled 12.vi ‏155 KB
    testing1.txt ‏114 KB

    You are trying to fit
    y(x)=a*cos(b*x)*cos(c*x)*exp(d*x)+e
    with [a, b, c, d, e] as adjustable parameters. This seems like a poorly defined model, for example you will have an equally good solution swapping b and c. Also from looking at the data, d should be negative, yet you give it a large positive value as guess. Periodic functions such as "cos" (I am not sure why you use "sin" in the title of the post) are always problematic, because you can fit equally well to an alias frequency by mistake. You need to be absolutely sure about good initial guesses here. Is the model really sufficient? For example, you don't account for possibe phase.
    Your file also does not contain enough significant digits, so there are multiple x values for each y. It seems however, that the x-values are linearly spaced, so it is possible to approximate the real x ramp (see attached).
    Anyway, to your question. You can skip the express VI and use "nonlinear curve fit" instead. If speed is a concern, you should use the VI model, which is pretty simple in this case. (fitting takes much less than a second)
    Aristofel wrote:
    ... I tried playing with the numbers and it seems when I put the right numbers in the function instead of using the parameters, the fitting is perfect,...
    Is this synthetic or real data? As a first step, you should generate fake data with known parameters and see how well the fit does if the estimates are somewhat off.
    What are the "right numbers" in this case?
    In any case, Your problem is probably better solved using e.g. a fourier transform. You should get two lorentzian peaks with the midpoint between the two related to (b) the separation between the two related to (c) and the lorentzian width related to (d). Your data gives a much more complex transform, so your model seems way too simplistic for your data anyway.
    Can you give us a bit more background on the origin of the data, the physics behind it, and the model?
    Attached is a literal translation of your VI to the plain "VI model" fitting. Still, nonlinear fitting seems to be the wrong choice for this problems as outlined above.
    LabVIEW Champion . Do more with less code and in less time .
    Attachments:
    SinExp.zip ‏55 KB

  • Nonlinear Curve Fit LM Formula String in Labview 8

    hi, guys. I write a vi which use Nonlinear Curve Fit LM Formula String. When I run it ,the program says "Syntax error of parser." and I don't know what's wrong with it, so help me,Please. By the way ,you can fill the arrays as you wish.
    帖子被trinight在02-11-2006 07:51 PM时编辑过了
    Attachments:
    curve fitting.vi ‏16 KB

    You MUST wire initial estimates for the parameters. Attached modification works just fine.
    LabVIEW Champion . Do more with less code and in less time .
    Attachments:
    curveFittingMOD.vi ‏17 KB

  • Crystal Reports Linear Regression Trendline Slope

    I need to know the slope of my linear regression trendline from my chart to determine whether the trend is positive or negative. I can't find any information on how to display and/or use that value in a formula.

    It appears that the steps I was taking was incorrect.  To actually get the trendline, you need to click the line in the line chart that you want the trendline to be against.  Follow the steps above BUT do not start it from the legend.

  • Using Multiple Linear Regression from SAP Predictive Analysis within S&OP

    How could I go about using a model exported from SAP Predictive Analysis, say a multiple linear regression model, as a stored procedure in HANA from within S&OP?

    Hi Kevin,
    You cannot use a model exported from SAP Predictive Analysis in S&OP.  S&OP uses the same PAL libraries from HANA for Statistical Forecasting. We enable a few statistical forecasting methods from PAL like exponential smoothing from S&OP.
    Thanks,
    Raghav

  • How to use the parameter "data" in the vi of Nonlinear Curve Fit

    I used "Nonlinear Curve Fit" to do state estimation. If I make the number of unknows a constant number, it is fine to code the fitting model for f(x,a). But if I want to code the number of unknows as a variable, how can I do this?
    Maybe "data" should be used here. But I just could not find any examples talking about how to use "data" here.
    Thanks.

    Hey hilary,
        Have you looked at the LabVIEW help for the Nonlinear Curve Fit VI?  Which version of LabVIEW are you using?  In mine, the VI is polymorphic, and you can declare the formula to be a formula string.  Then it provides pins to enter the input parameters programmatically.  Perhaps you could post a screenshot of how you are currently using the VI, and we could help more.
    Brian B
    Field Sales Engineer
    Tennessee/Southern Kentucky
    National Instruments

  • How to create curve fitted line chart?

    Line chart is formed with straight lines, but how to create curve fitted line chart?

    Jasper wrote a blog on curve fitting charts

Maybe you are looking for

  • Sticky load balancing across 2 ports with cookies

    Hi, I have a server configuration where I have 1 top level Apache server that deals with SSL termination (and handles static content) and proxy passes dynamic content onto 2 Tomcat servers on 2 ports, one for http requests (9001) and one for the requ

  • How to keep drawings? Draw highlights?

    Hi, I'm new in Java 2D. I use Graphics2D.draw method to draw some lines on the panel. But after another windows cover the panel, all the lines except the last point will lost. How to keep these drawings after another windows cover them? Thx a lots.

  • Aggregate with fixed value for 0SOLD_TO__0REGION wonu00B4t work

    Hi, We want to have a aggregate for a specific region. I have problem getting the aggregate to work. When testing it for aggregates in tc rsrt, it states that it will not use the aggregate because of Characteristic/Attribute 0SOLD_TO__0REGION does no

  • I want to be super user in badoo

    i want to buy 100 credits in badoo by my apple id

  • Iphone repair glass

    i on accident sat on my iphone,it put a crack and shatter on the glass,is my iphone covered?