A confusing lev-mar error

I am trying to fit a Lorentzian to some acquired data using the lev-mar function, and it returns the error "wrong model equation". I know for a fact that the data has a lorentzian shape because I wrote a little vi to fit it manually using the exact same equation. Does anyone have a suggestion as to what to do next, or at least what the "wrong model equation" error really means? Thank you.
JPC

The error refers to a syntax issue with the "model description" input.
This input is a cluster of three strings: model, which is the actual equation (Ex: a+b*x+c*x^2); paramters, which are the solvable variables (a, b, & c in the previous ex.) inputted as an array of strings; and the independent variable (x).
All 3 parts of the model must match exactly (e.g. you can't have 3 variables in the model and 1 in the parameters, and if you designate x as the independent variable, there must be an x in the model equation).
Additionally, the model equation follows standard LabVIEW formula node syntax, except there are no input variables designated ("y=x+1" won't work but "x+1" will) and you don't need a semi-colon terminator.
Let me know how it goes,
~j5
2006 Ultimate LabVIEW G-eek.

Similar Messages

  • Problem: Fitting Lev-Mar with Error Function

    Hi everyone,
    I have very little experience with LabVIEW and I'm trying for the first time to do some NonLinear Curve fit for some data I have.
    I've searched in forums for almost a day and couldn't find what I need. The problems are:
    1) I need to fit a function of the following type: P = Po/2 - Po/2*erf(sqrt(2)*(x-xo)/w) , where Po, xo and w are my parameters.
    But in my error2.vi I cannot link my y=sqrt(2)*(x-xo)/w  variable of the erf function to the input, because the erf.vi does not accept 1D array as input and doesn't give that as output as well. The output thing is another problem, since the input of F(x,a) needs to be a 1D array.
    2) I read about the Lev-Mar NonLinear CurveFit VI and I think I got what needs to be done. However, a I was having problems in wiring my Static VI Reference to the F(x,a) input in the Lev-Mar VI and it didn't give me a broken wire only when I made de Reference a "Strictly Typed VI Reference". What does that mean? Why did it only work with that?
    I know these are some pretty basic doubts, but I've been trying to understand it for quite some time and couldn't get this done.
    Thanks.
    PS* The fitting function (subvi) is the error2.vi file.
    Solved!
    Go to Solution.
    Attachments:
    error2.vi ‏13 KB
    FittingGaussianKnife.vi ‏15 KB

    Try this. Seem to work  just fine (LabVIEW 2013).
    (don't try to graph the best parameters, graph the best fit output!)
    LabVIEW Champion . Do more with less code and in less time .
    Attachments:
    FittingGaussianKnife_MODCA.vi ‏17 KB
    error2_MODCA.vi ‏14 KB
    erfit.png ‏40 KB

  • Lorentz fit of a curve with Lev-Mar

    Hello everybody! I am trying to set of data to a Lorentz curve to calculate a Q value (resonance.) I found a program on a thread from this forum that appears to work with the sample data set from the thread. However, when I try to run the program using my data set with known fitted coefficients as the initial guesses, we get an error in the Lev-Mar sub-VI -- something like “the input matrix is singular”. There’s a screenshot of my data in in the attached zip folder, as well as the text file containing my data.
    My data curves down (reaching a minimum) instead of up, as in the sample data set, but it seems like that should be accounted for by the different initial guesses. I am thinking that something else is going on; hopefully it is something simple that I am just missing. Any help y'all can provide would be greatly appreciated!
    Thank you!
    Attachments:
    Lorentz Fit.zip ‏1992 KB

    Hello Lynn,
    Yes, there are quite a few potential peaks in that data set. The peak you identified was the one that we are trying to fit (The peak should be trimmed by the cursors.) We used origin to fit that same peak in order to get the initial guesses for the coefficients in the screenshot. When it runs, we get the error message: "Error -20041 occured at NI_Gmath.lvlib: Nonlinear Curve Fit LM.vi:2 Possible reason(s): Analysis: The system of equations cannot be solved because the input matrix is singular." 
    Thanks!
    -Garrison

  • Lev mar parameter min value

    When I use the Lev Mar curve fit, I get an error that says at least one of my input parameters is NaN or Inf.  There is a place in my fitting equation where I divide by the parameter and take the square root, so if it was either zero or negative, this would not work.
    Is there a way that I could force Lev Mar to not choose values of 1 or zero for this parameter?  My initial guess is very small (on the order of 10^-4), but this parameter is time, so it should not be negative or zero anyways.

    What is your LabVIEW version? The function has been renamed to "nonlinear curve fit" many versions ago.
    There is a constrained nonlinear curve fit that lets you set parameter bounds. Use that instead.
    Can you show us your code and some typical data? If you calculate the model with your paramter guesses, does it look anything like the data?
    LabVIEW Champion . Do more with less code and in less time .

  • Curve Fit of ODE, should I use Lev-Mar or Constrained Nonlinear Optimization?

    I wanna do a curve fitting of differential equations, following is the equations:
    dx/dt = u*x-a*x
    ds/dt = b*u*x+c*x
    dp/dt = d*u*x+e*x+f*p
    and u = um*s/(km+s+s^2/ki)
    I've tried "nonlinear curve fit( Lev-Mar)", but I met difficulties when writing the f(x,a) of Lev-Mar.
    Then I tried "Constrained Nonlinear Optimization", I found that the example "Estimate Nonlinear Spring Constant.vi"
    in the "labview\examples\math\curvefit.llb" was similar to the fitting I tried to do, but there was only one parameter
    need to estimate in this example,but what I need is to estimate 3 parameters.
    However,I modified the example to my equations, it failed again.
    How can I achieve this? is it possible to do this fit only using Labview VIs or need Matlab Script Node?
    Any help will be appreciated.

    I forgot to mention that in the equations above,  a,b,c,d,e,f is constant,
    and the data of x,s,p corresponding with the data of time is already known,
    and which parameters I wanna identify is um,km,and ki
    帖子被myafu在12-22-2006 01:33 AM时编辑过了

  • Curvefit of the reflectivi​ty with Lev-Mar

    Hello,
    I am a beginner with Labview and I need your help, I recuper the data of the reflectivity from the spectrometer (3648 points) and I am going to make the fitting to extract information about the thickness and refractive indices n and k (k in the general case it will be zero because the materials used are oxides and I work in the visible range.
    I want to use the model of Lev-Mar but I have the problem with the model, i have used the formula node to write the eqaution of the reflectivity, and currently I am block.
    Data.txt
    column1 = Lambda
    column 2 : Reflectivity
    the substrate is Pyrex  ; n= 1,47
    the thin film is Ti-Nb, the index is like that of the titane(Antase) : ñ = 2,561 + i2,488
    Thank you very much.
    Nb: i know my english is so bad
    Attachments:
    fit1.png ‏36 KB
    fit2.png ‏30 KB
    Data.txt ‏51 KB

    Thank you very much Lynn,
    I did what you told me to do and it works a better,
    I would like to know if you can help me, I have the values of the reflectivity R as a function of the wavelength (lambda) but the indices " n "  and " k " are also a function of lambda.
    R = (n,k,d,lambda )   and  the dispersion equation n(lambda) and k(lambda)
    With the curvefit Lev-Mar is possible to define these parameter ? if you have ideas that will be cool

  • Please help on this Lev-Mar problem

    Hi,
    I have two acquisition data sources that need
    to be fitted. Then the fitted parameters are
    passed along with data for further processing.
    As the data is heardware generated, I made a
    similar 'signal generator' to present very closely
    the problem.
    ===Please see the attached vi file===
    As you can see, these two Lev-Mar's function
    / derivatives are obviously different. We can edit
    the fuction / derivative node. But the problem
    is that when one is edited, the other changes too.
    Anyways, we can NOT have two different functions.
    My question is: How to have two different function
    / Deveritives here?
    By the way, how to replace the MatLab box into
    function node in my attached example?
    I can 'wire' the out
    put to next if it's a
    function node. It says the type of variables are
    different (output is a real instead of array).
    Attachments:
    Lev-Mar-Question2.vi ‏99 KB

    You have a few options for multiple function/derivatives.
    1. If you can express the model functions using the formula string syntax, then you might consider using the "Levenberg Marquardt.vi". Unfortunately the Levenberg-Marquardt.vi does not allow the specification of the derivative of the model function and always uses numerical derivatives. It is also somewhat slower than the "Nonlinear Lev-Mar Fit.vi".
    2. You could also save a copy of the "Nonlinear Lev-Mar Fit.vi" using a different name, and also the "Lev-Mar ABX.vi" and "Target Fnc & Deriv Nonlin.vi" with different names. Then you would have a different set of VIs to implement the curve fitting on two different models. This is ugly, but would work.
    3. You could modify the "Nonlinear Lev-Mar
    Fit.vi", "Lev-Mar ABX.vi", and "Target Fnc & Deriv Nonlin.vi" to accept/pass VI references. The "Target Fnc & Deriv Nonlin.vi" would then perform a call by reference to a VI that you wrote implementing the current model function.
    To replace the Matlab script node place the formula node inside a for-loop. The for-loop will auto-index the x and t arrays, and auto-build the y-array.

  • How to constrain parameters in Lev-Mar?

    It's a common case for non-linear fitting.
    How can it be done in LabView's Lev-Mar?
    Thanks.

    The provided LabVIEW implementation does not contain options for parameter bounds.
    One solution would be to re-parametrize your code in terms of unconstrained variables that cause a constraint on your original parameters.
    Some transformations for one-sided or two-sided parameter bounds are given here:
    http://www.id.unizh.ch/software/unix/statmath/sas/sasdoc/stat/chap19/sect41.htm
    The link also lists references with more details.
    LabVIEW Champion . Do more with less code and in less time .

  • Ajustement de courbe (Fitt) Lev-Mar

    Bonjour/Bonsoir
    Je veux faire un ajustement de courbe en utilisant le modèle de Mar-Lev pour des mesures de la Réflectivité en fonction de la longeur d'onde mais j'ai pas réussi à le faire;
    Les valeurs de "n" et "k"  varient en fonction de la longueur d'onde mais la je les ai pris fixes, es ce qu'il y a une possibilité de prendre les paramètres comme étant des tableaux ??.
    Les valeurs de "ns" et "ks"  je peux les considérer fixes mais comment faire pour changer leurs valeursr dans la formule ( Utilisation d'une variable globale ???)
    je voudrais savoir aussi es ce que c'est mieux d'utiliser Lev-Mar : VI ou chaine de formule.
    Je sais pas s'il manque d'autres informations .
    merci pour votre aide.
    Cordialement.
    Pièces jointes :
    1NI.png ‏37 KB
    2NI.png ‏62 KB

    Bonjour,
    "Les valeurs de "n" et "k"  varient en fonction de la longueur d'onde mais la je les ai pris fixes, es ce qu'il y a une possibilité de prendre les paramètres comme étant des tableaux ??."
    --> oui, tout est possible. seulement je ne vois pas où sont ces paramètres dans le code, donc c'est dur.
    Les valeurs de "ns" et "ks"  je peux les considérer fixes mais comment faire pour changer leurs valeursr dans la formule ( Utilisation d'une variable globale ???)
    --> si je comprends, ils sont fixes mais tu veux pouvoir contrôler leur valeur depuis "l'extérieur". Dans ce cas, variable globale ou variable globale fonctionnelle (=VGF). Tu trouveras des exemples facilement pour les VGF
    "je voudrais savoir aussi es ce que c'est mieux d'utiliser Lev-Mar : VI ou chaine de formule."
    --> à toi de voir selon tes exigences et tes critères. La formule est peut-être plus performantes en terme de temps d'exécution, mais le code tient plus de place dans le diagramme, il est peut-être moins lisible. Moi je prendrais la formule, car ça s'exécute plus vite et on sait exactement quel calcul est fait.
    Francis M | Voir mon profil
    Certified LabVIEW Developer

  • Lev-Mar template missing

    I am trying to fit A*sin(w*t+phi) to some noisy data (amplitude, frequency, and phase are all to be detrmined from the matched sine). When I looked at the Lev-Mar fitting VIs I could not locate the template for the LM model function and gradient VI template mentioned in the Help file. labview\vi.lib\gmath\opti.llb\numerical is empty. (Help says this template should be there). The figure in the help file shows a cluster called Output Control as an input to the VI, but does not specify the elements of the control. I also could not find a way to put the formula into the String Formula version. Is there a listing of the available functions and syntax? The help did not seem to lead me to it.
    LV8.0.1 on Mac OS X
    Maybe it is just too late on Friday afternoon.
    Lynn

    Sarah, Christian,
    I had looked at that link and several others. I was hoping to find some reference where someone had made some practical suggestions reagrding optimizing the initial guesses, or at least some clues as to how to go about it.
    My data has a frequency range of about 2.5:1 so I was hoping I could just set the initial guess at the middle of the range. In my testing an initial guess 20% above or below the actual frequency resultis in erroneous values about 80-90% of runs with noise at 10% of signal amplitude which is better than the real data. With initial amplitude and phase equal to the data parameters and initial frequency guess at 1.2 times the actual I recorded two runs with the fit frequency at 99.9%. Eight others produced: 160%, 180%, 210%, 160%, 160%, 130%, 60%, and 160%. With the initial frequency at 80%, the results were somewhat worse.
    My suspicion is that because the partial derivatives of the model equation are also sines and cosines, the algorithm tends to find some kind of local minimum and converges to that even though it is a really poor fit.
    Here is my modified Lev-mar VI and the simple sine model VI (LV8). The default values are fairly typical of the data sets we will be getting.
    Thanks for the help.
    Lynn
    Attachments:
    Nonlinear Fit Lev-Mar.Berry.vi ‏41 KB
    simple sine model.vi ‏21 KB

  • Varying Lev-Mar init. conditions causes wide change in fit coeficients.

    Hey, I'm trying to use the advanced Lev-Mar fit vi to fit an exponential decay with an offset. I noticed that when I vary the initial condition for the time constant by 5% I get significant changes in my fit coeficient for the same parameter. However, when I multiply my input Y values by 10^4, the fit coeficients are more robust and change little with initial conditions that vary more than 10%. Also, the values now seem to match well with values I obtain when I perform the same fit in the Origin plotting program. Why is this? All my values are in double precision so I don't see how this could be a precision issue.

    The Lev-Mar has a well-known "bug" in the termination condition IF you fail to wire the "standard Deviation Input". In this case, the standard deviation is taken as 1, which is fine except for the case where your y-data is very small (e.g. all in microvolts or nanovolts). In this case, the function is considered converged after one iteration using the initial guesses.
    You have two options:
    (1) (not recommended) Edit the Lev-MAR.vi and make the diagram constant in the bottom center much smaller.
    (2) (RECOMMENDED!) Always wire a "standard deviation input array". In your case, just create an array with equal size as your data, initialized with numbers corresponding to the noise in your data. It does not need to be accurate, you could just take it as e.g. 10E-4 to 10e-6 times your y-range (y-max minus y-min).
    LabVIEW Champion . Do more with less code and in less time .

  • Flex 2 beta 3 compiler confused by syntactic error

    Hi,
    The Flex Builder 2 beta 3 compiler seems to get confused by a
    specific syntactic mistake I've made in my code.
    It is not making a "proper" syntax error report. It's instead
    throwing a nasty "An internal build error
    has occurred. Please check the Error Log" error, so I thought
    I should share that on the forum.
    The thing that lead to the "internal error" is that I wrote :
    var newCourseXMLDesc : XML =
    <CourseDescription
    nomDuPlat=_{courseNameTextBox.text.toString()} />;
    instead of that :
    var newCourseXMLDesc : XML =
    <CourseDescription
    nomDuPlat={_courseNameTextBox.text.toString()} />;
    Notice the position of the _ character just before the
    courseNameTextBox.
    I guess that should be fixed in a final version of the
    compiler.
    Cheers
    Nicolas Fonrose

    I just successfully deployed all three FDS web applications
    on Tomcat 5.5.17 with Sun 1.5.0_06 without any exceptions. From the
    stack trace it looks like this is thrown at startup. Can you
    confirm?
    Are you sure you deployed the war files cleanly?

  • Confused about install errors and missing folders? rdbms not existent?

    Hey there,
    I installed Oracle 11g on my Windows 7 laptop.
    I tried doing the post installation steps and one of them was run the utlrp script from the ORACLE_HOME\rdbms\admin\ folder. I searched my whole pc for the sql file or even the /rdbms folder and it is non existent on my laptop.
    I didn't receive any errors, it was a clean install so I am a little confused.
    On a side note, when I tried to install SQL Developer, it says:
    Cannot find a J2SE SDK installed at path C:\Program Files etc
    I downloaded the JDK from the java website so that error went away, now I got this error when I try and run the install:
    Unable to launch java virtual machine located at path C:\Program Files(x86)Java\jdk1.6.0_21\bin\msvcr71.dll
    Any help is appreciated!
    Thanks!

    do you see the java folder at oracle directory or in program file
    C:\Program Files(x86)Java\jdk1.6.0_21\bin\msvcr71.dll --- it is installed on program file
    Follow the steps below. to set the JAVA_HOME
    1.From your desktop, right-click My Computer and select the Properties option.
    2.In the System Properties window, click on the Advanced tab.
    3.In the Advanced section, click the Environment Variables button.
    4.Finally, in the Environment Variables window (as shown below), highlight the Path variable in the Systems Variable section and click the Edit button. Add or modify the path lines with the paths you wish the computer to access. Each different directory is separated with a semicolon as shown below.
    5.Add the code to the existing System variable path shown in the blue highlighted section in the picture below. Do not delete the original variable; you are only adding code to it
    http://mindprod.com/jgloss/jdk.html

  • MARS Error Log Message Thread 53300144:AnaRawmsgFileReader::

         Anyone have any idea about the below message from MARS? It is showing up frequently in the Backend Log Messages..
    Error
    ./pnesloader
    Thread 53300144:AnaRawmsgFileReader::Read: NOT found the two separators in  the end.

    It's only affected by devices that are sending "blank" syslog messages. It is worth investigating which devices sent "blank" syslog and modify the logging on the device itself, instead of changing the logging level on MARS itself.
    If it's not possible to check which devices are sending blank syslogs, then you can change the logging level on MARS to "fatal":
    Admin->System Maintenance->Set Runtime Logging level

  • Lev Mar parameters for Gaussian fit

    I am trying to analyse a Gaussian profile using the Lev-Ma r fit provided with LabVIEW. My problem is that I don't know the proper format for the function descriptions to use and get an error when using the fit. Has anyone done this in the past, and can help with the formating of the inputs to the fit.
    Thanks
    Eugene Lorman

    lorman wrote:
    > I am trying to analyse a Gaussian profile using the Lev-Ma r fit
    > provided with LabVIEW. My problem is that I don't know the proper
    > format for the function descriptions to use and get an error when
    > using the fit. Has anyone done this in the past, and can help with
    > the formating of the inputs to the fit.
    >
    > Thanks
    >
    > Eugene Lorman
    Eugence,
    I've been doing similar stuff myself, and found this link very helpful:
    http://www.originalcode.com/occdl.html
    Page down through and you'll find a downloadable VI that does
    peak fitting on a gaussian.
    HTH
    dave Langstaff
    Remove "spamkill." when replying to this message

Maybe you are looking for

  • My computer crashed and I need a new serial number.  I have my product key

    My computer crashed and I need a new serial number.  I have my product key

  • Can't Import MP4 Files Into DVD Studio Pro

    I'm trying to start a DVD Studio Pro 4 project, and have .mp4 video files. When I import them with the Assets>Import tab, they come in as MP4 audio files only, not movie files. The users manual says the integrated encouder auto encodes Quick Time ass

  • Slammed shut my G60 now display color is out of whack

    I am new to the forum and may not use the correct terminology. Let me know if I need to explain anything in more detail. In short I slammed shut my laptop, my bad. And since then the display is like looking at a photo negative image with color. The c

  • Horendous gps with C6, I want to throw my phone in...

    I am so freaaking sick of this phone, it is only few months old. I bought it mainly because of disposable keyboard and gps tracking. But gps just does not work. Today I am waling aroudn the city trying to get signal, because I was lost, and nothing h

  • Siebel analytics(Invoking Stored Procedure)

    Hi all, I am using Siebel Analytics(7.8.2) and am a new bee to this. I have invoked stored procedure from Siebel Administration but is it possible to do the same from Siebel web analytics?. I have a report where on clicking on a link/button i want to