Which method can be used to optimize parameters of a model, to fit experimental data? Concrete: Following parameters and calculation model:

Fix parameters:

P0 = 101325;
Pr = 0.71;
η = 1.838*10^-5;
κ = 1.4;
ρ0 = 1.19;
c0 = (κ*P0/ρ0)^0.5;
Z0 = ρ0*c0;
f = Range[400, 10000]; 
ω = 2*Pi*f;
d := 15*10^-3;

Adjustable parameters; accuracy should be 0.01, except σ (0.1);Range/Boundary conditions are in brackets.

ϕ -> [0.5 - 1];
σ -> [5000, 140000];
α -> [1, 4];
λ -> [1*10^-6 , 1*10^-4];
λ' -> [1*10^-6 , 1*10^-4];
kop -> [1*10^-11 , 1*10^-9];

Calculation model with formulas:

H = (λ^2*σ^2*ϕ^2)/(4*α^2*η*ρ0); 
g = Sqrt[1 + (I*ω)/H]; 
nup = η/(Pr*ρ0); 
Mp = (8*kop)/(λ^2*ϕ); 
wtl = (nup*ϕ)/kop; 
gp = Sqrt[1 + (I*Mp*ω)/(2*wtl)]; 
Reff = α*(1 + (g*(σ*ϕ))/(I*α*ρ0*\
Keff = κ/(κ - (κ - 1)/(1 - (I*gp*wtl)/ω));
kw = ω*Sqrt[Reff/Keff];
Zc = Sqrt[Reff*Keff];
Zs = -I*Zc*Cot[kw*d];
r = (Zs - 1)/(Zs + 1);
(*Target value a (absorption over frequency f *)
a = 1 - Abs[r]^2;

I want to import data like this: (Must the frequency steps be the same as the setps of the range of defined variable f?)

[![Absorption(y-axis) over frequency (x-axis)][1]][1]

My target is now, to get the adjustable parameters for the best fit to a given graph / import data.

Please give concrete answers or the best would be a concrete solution inculdung an optimization model with implemented boundaries! Some explanation or over suggestions are also welcome!

EDIT: first try:

fit = FindFit[data, 
  model, {ϕ, {σ, 100000}, {λ, 
    3.6*10^-6}, {λ', 6*10^-6}, α, {kop, 1*10^-10}}, f, 
  MaxIterations -> 10000]
Show[Plot[Labeled[model /. fit, "fit"], {f, 100, 8000}], 
 ListPlot[Labeled[data, "import"], PlotRange -> All]]

compariso of fit and data


So, thanks for the help with FindFit, that does generally work and fit well, unless there was a mistake in the formulas... The last question about this curve fitting is, how to implement constrains like

0.5 < ϕ < 1;

or that some other variable is not greater than another? I actually could give some estimations for the starting values, seen in the EDIT. But things like this(found in Help):

fit = FindFit[data, {model, {a > 0, 1 < ω < 2}}, {a, ω},

did not work.

Some tests gave good results if realtively good known starting variables, but in case of a less exact starting values, other parameters give a negative value. So I want to restrict more accurate. How to implement this in FindFit? Or do I have to take something like NMinimize?

  • $\begingroup$ Please reduce your question to a minimal working example that shows your problem. As the question stands now, you have a lot of symbols defined, but the essentials in the FindFit, namely the definitions of data and model, are missing. $\endgroup$ – Marius Ladegård Meyer Aug 14 '17 at 9:13
  • $\begingroup$ That said, FindFit already returns the best fit parameters as it's output. What else do you want? $\endgroup$ – Marius Ladegård Meyer Aug 14 '17 at 9:13
  • $\begingroup$ @JoeK please see: I accidentally created two accounts; how do I merge them? $\endgroup$ – Kuba Aug 16 '17 at 15:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.