LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Example Using f ' (x,a) in Model for LM Constrained Nonlinear Curve Fit

Solved!
Go to solution

I am trying to fit a Voight profile using the LM Constrained Nonlinear Curve Fit so that I can extract the Gaussian and Lorentzian parameters.  I am currently only using f(x,a) and it seems to work OK.  I'm not very familiar with LM curve fitting but I wanted to try to use the gradient f ' (x,a) as well to see if it improves the robustness of the fit.  I assumed that I would wire f ' (x,a) to just be the analytical derivative of the original convolution (using the derivative rule for convolutions).  However I have only found one user example that used f ' (x,a) in the model file and it did not seem to be the derivative of f (x,a).  I can't find any NI examples using f ' (x,a).  Could someone point me in the right direction?

 

Thanks 

0 Kudos
Message 1 of 5
(4,235 Views)
Solution
Accepted by topic author mpmarquez

Hi mpmarquez, 

 

Here's a related forum post that should answer your question. Please let me know if you have any further questions!

 

http://forums.ni.com/t5/LabVIEW/Lev-Mar-fit-linear-baseline-4-gauss/td-p/1721134

 

-N

National Instruments
Staff Certification Engineer
0 Kudos
Message 2 of 5
(4,202 Views)

Thanks for the example.  It seems to answer my question. I have one follow up question though.  Someone mentioned in the thread you linked to that for fitting experimental data that the partial derivatives aren't required and that the numeric derivatives will suffice.  Is that generally true?

0 Kudos
Message 3 of 5
(4,191 Views)

I consider altenbach to be one of the experts on fitting on the Forums.

 

If you have a function which has poorly behaved derivatives, you might find it advantageous to do your own calculations. You could define the derivatives in a way which makes sense for your physical model in the neighborhood of a discontinuity if the numerical calulations failed.  Gaussian and Lorentzian curves are smooth enough that I would not expect problems.

 

If you have already written a VI with the partial derivatives, you could always run comparisons using your data.  Then post the results so others can benefit from what you learned.

 

Lynn

0 Kudos
Message 4 of 5
(4,186 Views)

Thanks for the response.  I am trying to extract laser linewidth information using a self-delayed heterodyne.  It is possible that the data could be quite noisy which might appear discontinuous.  So I was thinking that providing the gradient information might make it more robust.  However maybe it would be easier to average the data instead. 

0 Kudos
Message 5 of 5
(4,174 Views)