Find real valued parameters of a complex equation/model by using optimization or curve fitting.
30 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Ryban1
am 8 Jan. 2025
Bearbeitet: Torsten
am 10 Jan. 2025 um 18:26
I am trying to replicate finding the optimized parameters of a Lorentz model defined in the paper titled, "EXTRACTION OF EFFECTIVE METAMATERIAL PARAMETERS BY PARAMETER FITTING OF DISPERSIVE MODEL" (linked here). I've provided the equation and table of paramters below:

I've tried the curve fitting tool and get different results especially when I try to change the bounds. Sometimes I am able to get paramters that match the table above but my confidence in repeatbility isn't high. I've also tried scripting code to use the "fittype", "lsqnonlin", or "fminsearch" but also get different answers as well. In the code below, I'm comparing the fit to the real and imaginary parts of the Lorentz model. The fit to the real data is way off and even though the fit to the imaginary values looks qualitatively good. For the fit to the imaginary part, I get different values for the estimated parameters compared to what's reported in the paper.
%% Parameters in Table
e_inf = 1.62;
wp = 2*pi*14.63*1e9; % GHz
vc = 30.69*1e6; %MHz
mu_s = 1.26;
mu_inf = 1.12;
wo = 2*pi*9.67*1e9; % GHz
delta = 1.24*1e9; % GHz
%%
fo = [7:0.01:12].*1e9; % GHz
w = 2*pi*fo;
mu_eff = mu_inf + ((mu_s - mu_inf)*wo.^2)./(wo.^2 + 1i*w*delta - w.^2); % equation in paper / Lorentz model
real_mu_eff = real(mu_eff);
imag_mu_eff = imag(mu_eff);
x = fo;
y = real_mu_eff;
x2 = fo;
y2 = imag_mu_eff;
myfittype = fittype("real(a+((b-a)*(2*pi*1e9*c).^2)./((2*pi*1e9*c).^2+1i*2*pi*x*d*1e9-x.^2))",...
dependent="y",independent="x",...
coefficients=["a" "b" "c" "d"])
myfit = fit(x',y',myfittype)
figure
plot(myfit,x,y)
myfittype2 = fittype("imag(a2+((b2-a2)*(2*pi*1e9*c2).^2)./((2*pi*1e9*c2).^2+1i*2*pi*x2*d2*1e9-x2.^2))",...
dependent="y2",independent="x2",...
coefficients=["a2" "b2" "c2" "d2"])
myfit2 = fit(x2',y2',myfittype2)
figure
plot(myfit2,x2,y2)
The results I was expecting were: a=1.12, b=1.26, c=9.67, and d=1.24. I 've atttached my attempts with using "lsqnonlin", "lsqcurvefit", and "fminsearch"; however I didn't have success in using those methods either. What is best way to find the parameters of the Lorentz model to get the values in the table above?
0 Kommentare
Akzeptierte Antwort
Torsten
am 8 Jan. 2025
Bearbeitet: Torsten
am 8 Jan. 2025
I don't know if this helps to get better results, but of course you have to fit real and imaginary part of mu_eff simultaneously, not with two separate calls to "fit".
And I think it's impossible to get a good result for the 4 parameters without supplying bounds and good initial guesses. Both can be supplied via the "fitoptions" ("Lower", "Upper","StartPoint").
5 Kommentare
Weitere Antworten (1)
Gayathri
am 8 Jan. 2025
Bearbeitet: Torsten
am 8 Jan. 2025
If the output of your fitting process is inconsistent, the fitting algorithm might be sensitive to the initial guess of parameters. We can also experiment with different fitting algorithms that suits the data to be fitted. We can use the "fitoptions" function to specify the "StartPoint", "Method", Tolerance etc.
Please refer to the below code which implements the same.
%% Parameters in Table
e_inf = 1.62;
wp = 2*pi*14.63*1e9; % GHz
vc = 30.69*1e6; %MHz
mu_s = 1.26;
mu_inf = 1.12;
wo = 2*pi*9.67*1e9; % GHz
delta = 1.24*1e9; % GHz
%%
fo = [7:0.01:12].*1e9; % GHz
w = 2*pi*fo;
mu_eff = mu_inf + ((mu_s - mu_inf)*wo.^2)./(wo.^2 + 1i*w*delta - w.^2); % equation in paper / Lorentz model
real_mu_eff = real(mu_eff);
imag_mu_eff = imag(mu_eff);
x = fo;
y = real_mu_eff;
x2 = fo;
y2 = imag_mu_eff;
opts = fitoptions('Method', 'NonlinearLeastSquares', ...
'StartPoint', [1.5, 2, -1, 1], ... % Example initial guesses
'MaxIter', 100, ...
'TolFun', 1e-8);
myfittype = fittype("real(a+(((b-a)*(2*pi*1e9*c).^2)./((2*pi*1e9*c).^2+1i*2*pi*x*d*1e9-x.^2)))",...
dependent="y",independent="x",...
coefficients=["a" "b" "c" "d"], ...
options=opts);
myfit = fit(x',y',myfittype)
figure
plot(myfit,x,y)
opts1 = fitoptions('Method', 'NonlinearLeastSquares', ...
'StartPoint', [0, -1, -2, 1], ... % Example initial guesses
'MaxIter', 100, ...
'TolFun', 1e-8);
myfittype2 = fittype("imag(a2+(((b2-a2)*(2*pi*1e9*c2).^2)./((2*pi*1e9*c2).^2+1i*2*pi*x2*d2*1e9-x2.^2)))",...
dependent="y2",independent="x2",...
coefficients=["a2" "b2" "c2" "d2"], ...
options=opts1);
myfit2 = fit(x2',y2',myfittype2)
figure
plot(myfit2,x2,y2)
I am able to obtain a consistent output as shown below using this approach.

You can also try experimenting with other parameters within "fitoptions" function for better and accurate curve fitting.
For more information on "fitoptions" function, please refer to the below documentation link.
Hope you find this information helpful.
Siehe auch
Kategorien
Mehr zu Get Started with Curve Fitting Toolbox finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!