LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

non linear curve fitting

That is your VI that you gave me yesterday, It does not do the fitting properly.
 
 
0 Kudos
Message 11 of 16
(1,261 Views)

I am so sorry; I got a little bit confused with my data files as I have like 100 data files.Smiley SadSmiley Wink

 

Could you ignore the last three messages, and just have a look at this VI that you gave me yesterday, It is working for that set of data, but why doesn’t it work for this new data set?

 

 

0 Kudos
Message 12 of 16
(1,255 Views)
Hi
 
It is working nowSmiley Very Happy. I am so happy now. Thanks alot.
 
You were very very helpful.
 
All the best
 
0 Kudos
Message 13 of 16
(1,250 Views)

I guess you found out to delete the last line so you don't get an extra zero. 😉 Here are a few more things you should consider:

  • I always recommend to also graph the model using the parameter estimates. This way you can see if you're even close.
  • Many times it is possible to calculate the initial estimates automatically since. In this case you could find the position of the max absolute y value and use its y value and x-position for a1 and a2, respectively. (this works for positive and negative a1 since your model does not have a significant offset.).

See modification "MOD2"

You have a signifincant systematic error, possibly caused by the fact that your data is actually not really a Lorentzian. An alternative explanation would be that your model is insufficient. For example if you would add a fourth parameter (a4) allowing for a small offset, the residue improves by about a factor of 10 (!).

See modification "MOD2-4params" (image below).

 



Message Edited by altenbach on 03-01-2008 11:31 AM
0 Kudos
Message 14 of 16
(1,241 Views)

Could you have a look at the part of the program that I have highlighted and explain it?

I can not really understand what you are trying to do in this bit of code. 

0 Kudos
Message 15 of 16
(1,230 Views)
  1. This is a static reference to a VI used inside the fitting algorithm that calculates your function based on the x array and the parameters. It is called by reference at (4).
  2. Here we look at the absolute Y data to see where the aboslute maximim is. We use the index to find the y and x value at that location.This will give us an estimate of the amplitude (A1) and position (A2).
  3. We assume that the width paramtere (A3) is a constant at 1e6. We then form an array of these three values to automatically generate reasonable initial parameters to be used by the fitting tool.
  4. Here we call the function by reference node to calculate how Y would look like using the parameter estimates. This way we can ensure that they are reasonable.

All clear?



Message Edited by altenbach on 03-02-2008 09:58 AM
0 Kudos
Message 16 of 16
(1,217 Views)