LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Non-linear curve fitting for complex data

Hello Darin,

 

thanks a lot for your reply.

 

I tried your hints, but with no changes in my results. I tried the termination up to 1E-1 with no effect and included a shift register to use the best fit parameters for a new calculation. No enhancement. The results are the same as I wrote in my first posting.

 

Fitting of my LabVIEW Application

C0 = 695,885 pF

C1 = 115,8 pF

L1 = 13,972 mH

R1 = 2,687 Ohm

 

Which best fit values have you got?

Did you had time to look for the analytic function at your notebook?

 

Thanks a lot for your help.

 

Best regards,

Michael

Download All
0 Kudos
Message 41 of 44
(1,211 Views)

First of all, you are graphing the data on a log scale, but fitting it on a linear scale. Log scale also has a disadvantage that the negative regions of the imaginary part don't show. Your data spans many orders of magnitude and the differences in the wings are really small on an absolute scale.

 

Maybe it would be better to fit for the "log(real part)" and convert it back later if you want a better match in the wings at the expense of matching the peak (if you want it to look good on a log scale). Is the formula even sufficient to get a better fit? Maybe not. Maybe you would need a more complicated model? Also, the parameters don't seem to scale very well: tiny changes lead to huge changes in the graph. You might want to look at the conditioning number of the matrices generated.

 

Two additional suggestions:

  • Use a static VI reference for the model.
  • Always (Always!) also plot the curve calculated from the initial estimates.
Message Edited by altenbach on 03-01-2010 09:28 AM
0 Kudos
Message 42 of 44
(1,196 Views)

I found the expression I was looking for, it turns out I used this as an equivalent circuit model for a piezoelectric structure about 10 years ago.  My code was written using CINs and a homemade implementation of the LM fit, so it is hard to recreate at the moment.  A couple of notes that I found (why you keep notebooks).  It all comes down to picking good initial guesses, and this can be especially tricky when dealing with resonant circuits.  My notes indicate that only fitting the lower frequency section seemed to work reasonably well (avoiding the resonance), try fitting just the first 300 or so points of your data.  Works for the one sample you posted, try it for others.

 

The analytic functions for the derivatives can be implemented if necessary.  You may get to perform the C to G conversion yourself.

 

A quick way to see how good your initial guess is is to set the max iterations to 0 in the termination control.

 

 

 

0 Kudos
Message 43 of 44
(1,186 Views)

Hey !

 

Sorry for bringing this old thread back to life.

 

I use a combination of different code written previously on the same topic, in order to do data fitting of impedance
 (circuit described in Complex_Function.vi). I think that's properly implemented (checked it on a few values, that's fine).

 

Initial values

C1 =4.7 uF

R1 = 20 Ohms

R2 = 220 Ohms

 

Yet, I keep having the same error being " error 20068 occrued at NI_Gmath.lvib.LM get new coefficients.vi:1.
 Which I do not understand.

 

Let me know if you have some clues to solve this mistake. I attached the code in the llb and the excel file I am using.

 

thanks 🙂

 

Kentmey

 

Kentmey
Download All
0 Kudos
Message 44 of 44
(873 Views)