curve fitting non-linear data with a logarithmic distribution

I am attempting to fit a set of conductance versus frequency data. I have developed the circuit model, and am now attempting to isolate the diode properties of capacitance, resistance, and inductance. When i use the fit() function (outlined below) it weights too heavily toward the high frequency range because it is fitting a linear frequency distribution. How do I get the fit() function to use a logarithmic frequency distribution?
f = logspace(1,7);
Gmp2 = @(C1,C2,L,R,r1,r2,f)(r1+r2+R.*(pi.^2.*f.^2.*...
(C1.^2.*r1.^2+C2.^2.*r2.^2).*4.0+C1.^2.*C2.^2.*pi.^4.*...
f.^4.*r1.^2.*r2.^2.*1.6e1+1.0)+pi.^2.*f.^2.*...
(C1.^2.*r1.^2.*r2+C2.^2.*r1.*r2.^2).*4.0)./(R.*r1.*...
2.0+R.*r2.*2.0+r1.*r2.*2.0+R.^2+r1.^2+r2.^2+L.^2.*pi.^2.*...
f.^2.*4.0+C1.^2.*pi.^2.*f.^2.*r1.^2.*r2.^2.*4.0+C2.^2.*pi.^2.*...
f.^2.*r1.^2.*r2.^2.*4.0-C1.*L.*pi.^2.*f.^2.*r1.^2.*...
8.0-C2.*L.*pi.^2.*f.^2.*r2.^2.*8.0+C1.^2.*L.^2.*pi.^4.*...
f.^4.*r1.^2.*1.6e1+C2.^2.*L.^2.*pi.^4.*f.^4.*r2.^2.*1.6e1+C1.^2.*...
pi.^2.*R.^2.*f.^2.*r1.^2.*4.0+C2.^2.*pi.^2.*R.^2.*f.^2.*r2.^2.*...
4.0+C1.^2.*pi.^2.*R.*f.^2.*r1.^2.*r2.*8.0+C2.^2.*pi.^2.*R.*f.^2.*...
r1.*r2.^2.*8.0+C1.*C2.*pi.^2.*f.^2.*r1.^2.*r2.^2.*8.0+C1.^2.*C2.^2.*...
L.^2.*pi.^6.*f.^6.*r1.^2.*r2.^2.*6.4e1+C1.^2.*C2.^2.*pi.^4.*R.^2.*...
f.^4.*r1.^2.*r2.^2.*1.6e1-C1.*C2.^2.*L.*pi.^4.*f.^4.*r1.^2.*r2.^2.*...
3.2e1-C1.^2.*C2.*L.*pi.^4.*f.^4.*r1.^2.*r2.^2.*3.2e1);
Gmp2fittype = fittype(Gmp2, 'Independent',{'f'})
Gmp2fitoptions = fitoptions(Gmp2fittype);
Gmp2fitoptions.Robust = 'bisquare'
Gmp2fitoptions.TolFun = 1E-10;
Gmp2fitoptions.Tolx = 1E-10;
Gmp2fitoptions.StartPoint = [8.15E-10,1.01893E-8, 9.0e-7, 105, 36000, 1337];
Gmp2fitoptions.Upper = [1E-3,1E-3,inf,1000,inf,inf];
Gmp2fitoptions.Lower = [0,0,0,0,0,0];
%Gmp2fitoptions =
%Normalize: 'off'
%Exclude: []
%Weights: []
%Method: 'NonlinearLeastSquares'
%Robust: 'Bisquare'
%StartPoint: [1x6 double]
%Lower: [0 0 0 0 0 0]
%Upper: [1.0000e-03 1.0000e-03 Inf 1000 Inf Inf]
%Algorithm: 'Trust-Region'
%DiffMinChange: 1.0000e-08
%DiffMaxChange: 0.1000
%Display: 'Notify'
%MaxFunEvals: 600
%MaxIter: 400
%TolFun: 1.0000e-10
%TolX: 1.0000e-10
[Gmp2fitObj_virgin Gmp2gof_virgin Gmp2output_virgin] = fit(GvF(5).freq.*1000,GvF(5).cond,Gmp2fittype,Gmp2fitoptions)
figure
hold on
%manually change the axis to log - log
plot(GvF(5).freq.*1000, GvF(5).cond) %Plot my actual data
plot(Gmp2fitObj_virgin) %plot my fit object
plot(f,Gmp2(8.15E-10,1.01893E-8, 9.0e-7, 105, 36000, 1337, f))
%plot curve that actually has a distribution that fits my data

Answers (1)

Matlab has no implementation specifically, transform your frequency vector to log10(f) and fit; to evaluate you then also must use the transformed frequency as the coefficients are in log space. Alas, all the fit statistics are also then in the transformed space so things like R-square are inflated.

Categories

Asked:

on 6 Apr 2016

Answered:

dpb
on 6 Apr 2016

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!