-------

there's two ways i've done this.

first was to use nl2sol fortran routine which is a non-linear  
optimization routine (http://www.csit.fsu.edu/~brkardt/f_src/nl2sol/ 
nl2sol.f90- original fortran is at netlib.org as ACM TOMS 573). the  
second is to use Excel's Solver.

in either case you are trying to adjust the parameters in one or more  
Lorentzians to minimize the difference between the data points and  
the fit.

the obvious metric to use is something like sum over data points i of  
| eps_data(w_i) - eps_fit(w_i) |, where eps_data(w_i) are your data  
points (complex numbers) and eps_fit(w_i) is from your sum of  
Lorentzians (also complex numbrs).  In the literature, some claim to  
first do the imaginary fit first and then use that to do the full  
fit. it really depends on the data.

using nl2sol this is straight forward. in Excel, use Tools>Add- 
ins...>ToolPak Analysis so you have support of complex numbers. after  
some excel drudgery, you can set up Solver (also an Add-in) to vary  
the parameters in your Lorentzians to minimize the metric you have  
decided on.

Steven is right, though, almost every time the schemes fail. you tend  
to have to help them along usually by giving them some reasonable  
values of the starting values. that is why i tend to do fits in  
Excel- it's easy to quickly adjust the parameters to be almost  
correct values and let Solver (hopefully) find the final solution.

for your problem, Matt, i see:

1) too few points. one Lorentz has three parameters. you have seven  
data points. fitting to such a small data set is problematic (in a  
statistical meaningful sense).
2) the sign of Im(eps) is correct?

        gp

------




On Jul 8, 2007, at 1:20 PM, Steven G. Johnson wrote:

> On Tue, 3 Jul 2007, matt wrote:
>> I have the following data for a lossy material (nylon), and I'd  
>> like to
>> find the parameters for meep's lorentzian model which fit the data:
>>
>> frequency (hz)  real(eps) imag(eps)
>> 60      3.7     -.0666
>> 1e3     3.5     -.0651
>> 1e6     3.14    -.068452
>> 1e8     3.0     -.06
>> 3e9     2.84    -.033228
>> 2.5e10  2.73    -.028665
>>
>> There was an indication in a previous post that this is simple:
>>
>>> G.J. Parker
>>>  original patch posted by Steven, this does reduce memory  
>>> requirements when
>>>  using Lorentzians. i have no problems using five Lorentzians w/  
>>> this patch.
>>>  one can write a stupid excel spread sheet to fit N lorentzians  
>>> to a table of
>>>  (experimental) complex epsilons...
>
> I'm not sure it's quite so simple, because most off-the-shelf fitting
> programs only fit a real-valued function, whereas here you have to  
> fit a
> complex-valued function.  In general, you have to use a nonlinear
> optimization program to do the fit (to minimize the sum-of-squares  
> errors
> or whatever error criterion you prefer).
>
> I don't have any off-the-shelf code to do this for the Lorentzian  
> problem
> (although of course there are lots of off-the-shelf nonlinear  
> optimization
> routines), but perhaps someone on the list does.
>
> Steven
>
> _______________________________________________
> meep-discuss mailing list
> meep-discuss@ab-initio.mit.edu
> http://ab-initio.mit.edu/cgi-bin/mailman/listinfo/meep-discuss


_______________________________________________
meep-discuss mailing list
meep-discuss@ab-initio.mit.edu
http://ab-initio.mit.edu/cgi-bin/mailman/listinfo/meep-discuss

Reply via email to