Correct formula format in curve fit express vi

I'm trying to implement this formula (see attached jpg) in the Curve Fit Express VI but I can't seem to get it into the correct format (format checker light stays red).  It works ok in the Formula Express VI but not here.  Is this correct?   a*(1-exp(-(b*x)**c))
Solved!
Go to Solution.
Attachments:
weibull.jpg ‏3 KB

They have a terrible time making up their mind, in this case you need to use '^' for exponentiation instead of '**'.

Similar Messages

  • Nonlinear curve fit

    Hi everybody,
    I am trying to fit a custom nonlinear curve to my data. I want to fit a curve to the data twice. After the first fit, I want to use the coefficient a (6.57962) in my second curve fit as my coefficient b. When I try to use this and create a custom equation by string concetanete, everything seems fine but I do not get what I expect to get. To double check I used curve fitting express VI and I added 6.57962 as a coefficient in my equation and at the end a turns to be 6.752. However, this does not happen in my second curve fit. Does anybody have any idea what might be wrong? I cannot find my mistake, could you please help me?
    Thank you very much
    Attachments:
    Read.vi ‏129 KB
    read.png ‏66 KB

    The errors you get provide some clues, although they are not very explicit.
    The -23001:  Syntax error of parser  is usually a sign that your string describing the function is ill-formed or that there is a parameter mismatch. You have both.
    The string array constant feeding into the second Lev-Mar VI has two elements, the second one being an empty string.  Even though the string is empty, the parser expects two elements in the Initial Parameters array. But since your equation has only one parameter (a), the proper solution is to remove the blank element from the constant array.
    The other problem is that the first Initial Parameters array is empty.  Maybe you always enter two values but I did not know what to put in. 
    The second fit is somewhat sensitive to the initial Parameter value. Negative values do not work. 1 returns 6.753... 2 through 6 and 8 (integer values only) return 6.246... 7 returns the same result as 1. Values 10 and above return the value entere with error -20041 (singular matrix) appearing at >=12.
    The initial b parameter in the first fit does not matter over a fairly wide range.
    I also noticed that you seem to have a severe allergy to straight wires. Wires running all over the diagram and particularly behind other objects makes it very hard to read your code. Dataflow along the wires should generally be from left to right as much as possible. The code works the same regardless of the number of bends in the wires but straighter wires are much easier on the programmer.
    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

  • 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

  • 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

  • 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

  • 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

  • Constrained nonlinear curve fit can properly handle the function like ln(1+b(x-xc)/a) ?

    Hi all,
    I met some problems about using constrained nonlinear curve fitting vi. It seems to me that this vi can't properly deal with the function like ln(1+b(x-xc)/a), a,b, and xc are the parameters, and b is in the range of 0 and -1. The reason I said that is as I used the other nonlinear fitting function in the other software, like Originlab, the fitting function can work properly.
    The error message from LV occurs as 1+b(x-xc)/a is less than zero. 
    However, due to a,b are both adjustable parameters, how could this situation happen ?
    Now I attach the vi files. The attachment includes main vi, mathmatical formula, and an input XY txt file.
    I appreciate any help or suggestion from you!!
    Here is the error message
    Joy
    Solved!
    Go to Solution.
    Attachments:
    LN-fitting.vi ‏21 KB
    LN-fittingmodel.vi ‏18 KB
    Book2.txt ‏1 KB

    Thanks for reply. whitenoiz 
    Actually I have more than 100 XY data set to test my vi. Some of the data set can be fit flawlessly. And the best fit parameters obtained from my vi are exactly the same as those from other analytical software, like OriginLab. In this case, I know my vi is valid. And in this scenario, I also found 1+b(x-xc)/a is always larger than zero with the best fit parameters (a and b). However, for certain XY data set, the error message will pop up if I use LV built-in vi, but I still can obtain the best fit parameters with OriginLab. And then I realized that error message always pops up as 1+b(x-xc)/a is less than zero, which it means to me that as LV built-in vi handles this type mathematical function, this built-in vi will encounter some difficulties. 
    I will step through my code, and also focus on the Matrix Left DivisionMV.vi, try yo find where the problem is.
    Best regards,
    Joy

  • For "Nonlinear Curve Fit.vi", what does -20068 mean and how can I avoid it?

    Hey guys,
    I am trying to fit an oval in a set of 2D data points, which represents a partial oval.
    So I am trying to see if "Nonlinear curve fit.vi" would work in the situation.
    However, sometimes that math VI would give me an error -20068 and would return incorrect fitting parameter.
    I can't figure out what condition would return that error so can you tell me
    what the cause is and how I can avoid that error?
    You can run the attached LabVIEW 2013 VI and see the error.
    Attachments:
    ellipse fit data.zip ‏41 KB

    jcyth wrote:
    The model is a result of solving the ellipse equation for y, 
    (x^2)/(a^2) + (y^2)/(b^2) = 1
    So I don't really see a simple way to make the negative values less likely...
    but maybe I can use "Constrained Nonlinear Curve Fit" where I can bound the parameters then?
    This is slowly drifting away from a LabVIEW problem but any help is appreciated! 
    The solution is to re-parameterize the problem and solve for something much less pathological
    You can directly fit for the above formula by providing x&y for all points to the model and optimize the four ellipse parameters until you get an array of all ones.
    I quicky coded this in the attached example and it seem to be quite stable, even with lots of noise.
    See if this works for you.
    LabVIEW Champion . Do more with less code and in less time .
    Attachments:
    Ellipse FittingMODCA.zip ‏40 KB
    FitEllipse.png ‏26 KB

  • 2 real-time plots + curve fits on the same x-y graph

    Hello all-
    Per the title, I'm trying to plot two series, both in real time, plus curve fits for each series on the same x-y plot.  Some background on the subject - this will be used to show the temperature distribution across a counter-flow heat exchanger.  So the x-y plot will plot temperature vs. position for two different flow streams - a hot flow stream, and a cold flow stream.  I would like to plot them both on the same graph so the temperature relationship between the two flows can be clearly seen.  If I can plot 2 series with simple lines connecting the points that would be fine, but would prefer some smoothing on the line or using a curve fit if that is possible to do in real time.
    A screen shot of my block diagram is linked below.  As you can see, the diagram is symmetrical with the inputs from the cold flow being processed on the top, and the inputs from the thermocouples in the hot flow being processed at the bottom.  I've got 2 issues:
    1.  Plotting 2 series on the same X-Y graph in real time.  (I've done this before, but never in real time).  Am I correct in assuming, if I append the array so it is a 3-D array (X, Y1, Y2), that I can plot both series on the same X-Y graph?  The individual X-Y graphs are functional, but I would like to combine them.
    2.  I've circled a bundle output which outputs the X,Y values of a curve fit.  The output here is a string (pink wire), so I cannot plot it on the X-Y graphs which are shown, due to it being 2 different data types.  Is there any way to plot the curve fit on the same graph?  Is LabVIEW capable of doing this in real time?
    Thank you for any help...   I realize that some of the answers here may be obvious, but visualizing what's going on in LabVIEW is a bit of a challenge for me, since I'm used to seing text-based code in VBA and MATLAB.
    Attachments:
    HX Block Diagram 2.jpg ‏302 KB

    The output you have circled is a cluster of two 1D arrays, not a string.
    XY graphs take a varirty of inputs (array of points, cluster of x and y arrays, complex arrays, etc.) but you cannot mix datatypes in a single graph. Since you are graphing arrays of points (a point is a cluster of an x and y scalar), you need to do the same for the data you circled. Simplest would probably be to just wrap an autoindexing for loop around the bundle function. See how far you get.
    If you want detailed help, please attach your actual VI. We cannot debug a picture.
    LabVIEW Champion . Do more with less code and in less time .

  • Nonlinear Curve Fit Error

    I am trying to get a multi-dimensional fit working by using a nonlinear curve fit VI and everytime I run it I get an error saying that my samples need to be greater than 0. The specific error message is: "Error: Analysis samples need to be > 0." Does anyone know what is wrong? I have tried to reinitialize my input parameter array to zero, recompile the VI, etc. and still get the same error regardless.
    I have attach all my VI's.
    Thanks,
    Ynessa 
    Attachments:
    Multidimensional Fit.zip ‏65 KB

    ytran wrote:
    I am farely new to labview and have not figure out the best way, so that my diagrams stay smaller since my width and height are farely large. What do you mean eliminate the local variables in the loops of the model? 
    In the model, you have a hidden indicator called pixel size, which you write once outside the loop and then continuously read over and over again with every iteration of the loops via local variables. SInce the value does not change during the execution of the loops, reading the same indicator over and over is just a waste of efforts. Why involve the UI if the valie is right there in the wire?? The correct way would be to delete that indicator and the local variables and simply connect all by wires.
    Did you understand my other comments?
    ytran wrote:
    The typical values for the controls are as follow:
    Pixel Size (um) = 5.2
    x0 (mm) = 640
    y0 (mm) = 512
    Focal Length (mm) = 1000
    Wavelength (mm) = 561
    Beam Diameter = 1
    Amplitude = 100
    Background Amplitude = 10
    Are all of those fitting parameters or are some of them constant and known?
    LabVIEW Champion . Do more with less code and in less time .

  • Nonlinear Curve Fit VI keeps all initial parameters

    My question is about fitting a curve with nonlinear curve fit VI. The fitting function has the formula like
    A/((x/I)^p-C)+B, where fitting parameters are {A, B, C, p, I) and variable is x. I tried to use both Nonlinear Curve Fit VI and Constrained Nonlinear Curve Fit VI, but neither gives me fitting parameters other than what I input as the initial parameters. As an example I am attaching the data set file where the fist column is x and second column is y. The initial fit parameter set is {2,0,1,2,90}. It would be appreciated if someone could point out how I use either these fitting function to get the best fit.
    Attachments:
    60QR.zip ‏1 KB

    Actually my LV code is quite simple and has nearly nothing more than the nonlinear curve fit vi itself. Anyhow I am attached my code here so that you could at least run and see what my question is about. The caller VI is "Curve Fitting.vi". The subVI inside it that calls the curve fitting function has two flavors inside. What is enabled uses the contrained nonlinear curve fit vi while the other one that is currently disabled, calls the function of nonlinear curve fit vi.
    Thanks.
    Attachments:
    Curve Fitting with a Nonlinear Model.vi ‏29 KB
    Curve Fitting.vi ‏17 KB

  • Curve fit

    Hi! I want to ask how I can fit a curve and see this in the graph for the obtained 2d array.
    I can obtain a 2d array (x-y) as a result of loop iteration clicking "Next Step" button for 14 times. After that, I want to fit a curve for this 2d array as a function of y=f(x).
    Also, I want to see the formula, and also function coefficients for this curve.
    I have tried a curve fitting as can be seen from the attached picture. However, it always failed. I can not obtain purely x-y curve (y=f(x)). Also, I have attached the sample VI. Could anyone help me ? I'm looking forward to hearing from you.
    Solved!
    Go to Solution.
    Attachments:
    sample_the_latest_one.vi ‏182 KB
    blockdiagram.JPG ‏51 KB

    Could you attach a typical data file? Thanks!
    Even better, create an indicator on the 2D array leading to the second loop. Run the VI and start fitting so the indicator contains 2D data. Now make the new indicator a constant with typical data (right-click terminal...change to constant). Now save and attach the VI. 
    mechen wrote:
    I attached the second while loop to use its stop button. I defined its stop button as a "Curve Fitting" button as can be seen from the front panel.
    Why not make it a state machine with a single loop? Your data is already in shift registers, so it would be available in the main loop. All you need is another state. The way you program it, you cannot easily go back to reading new data without additional code. Your fitting loop still needs a small wait or an event structure. Fitting needs to be done only of one of the inputs changes and not millions of times per second. You also don't need to wire all inputs, only the ones you want different from the defaults.
    Why do you have two instances of the same 2D array diagram constant. This makes the code unmaintainable, because identical changes would need to be done in two different places if you need to modify things in the future.
    mechen wrote:
    My question is how I can obtain a graph for 2d array.
    The x-axis will be the first column of the 2d array. The y-axis will be the second column of the 2d array.
    If x is not spaced equally, you need an xy graph. Simply extract the two columns using "index array", then bundle them into an xy graph. Check the shipping examples.
    LabVIEW Champion . Do more with less code and in less time .

Maybe you are looking for

  • Unable to import a java class in a jsp file

    Hi, I am trying to import a java class in my jsp. ------------------jsp--------------- <jsp:useBean id="form" class="com.company.portlets.searchApps.object.SearchOBJ" scope="request" /> <jsp:setProperty name="form" property="*" /> <input type="TEXT"

  • Built-in iSight not working in Safari/Firefox after 10.6 or 10.6.1 update

    Hello, My built-in iSight is no longer working in Safari or Firefox. For example, if I were to go to a website to broadcast my webcam, the flash applet comes up asking to allow/deny the use of camera, I allow, but the camera does not engage (green li

  • IPhine 5s won't download app updates

    IPhone 5s 7.1.2 can't download app updates today. I have 1.9g available space and Apple support says the apps store is working. I'm at home on my wifi router and I can download updates on my iPad. I keep getting the popup message that the app cannot

  • Video Call with more than 2 people?

    Hi ! I've seen that video calls for groups are currently not working on Skype for Android : We can join a video call between 2 or more people but only with the audio : we can hear everything, but we can't see anything (or being seen by the other peop

  • NTP server setup in DMZ

    Hi Team, We have Windows 2008 AD infrastructure with Single domain Single Forest & 30 remote AD sites with RODC in it. We are planning for NTP server setup on Windows 2008 server in DMZ......can someone help me with steps for setup. What is best prac