"Benjamin " <benjami
...@gmail.com> wrote in message <jhbdon$4l
...@newscl01ah.mathworks.com>...
> Hello to everyone,
> I am trying to extract the parametric values from fitting a set of dielectric spectrum complex data to a complex model as a function of the angular frequency w. As you can see, the dielectric model "d" is a complex function and the parameter vector "a" is real by definition.
> However, the results do not show a good agreement when I plot the data "Y" versus the model "d" using the parameters "afinal" obtained from the fitting.
> Anyone know how to fit this system of equations? Any ideas? Tips?
> Thanks in advance.
> global X Y
> a; % is the initial vector model parameters
> X; %X are the frequency values
> Y; %Y are the dielectric complex data
> %options for the non-linear fitting
> options = optimset('MaxFunEvals',10000);
> options = optimset(options,'MaxIter',5000);
> options = optimset(options,'TolFun',1e-9);
> options = optimset(options,'TolX',1e-9);
> [afinal,RESNORM,RESIDUAL,EXITFLAG] = lsqcurvefit(@myfun2,a,X,Y,[],[],options);
> function d = myfun2(a,X)
> %a=[a1 a2 a3 a4 a5 a6 a7 a8 a9 a10 a11 a12 a13 a14]
> e0=8.85e-12; %vacuum permittivity
> d = a(1)+ ...
> (a(2)./(1+(1i*2*pi*X*a(3)).^(1-a(4))))+ ...
> (a(5)./(1+(1i*2*pi*X*a(6)).^(1-a(7))))+ ...
> (a(8)./(1+(1i*2*pi*X*a(9)).^(1-a(10))))+ ...
> (a(11)./(1+(1i*2*pi*X*a(12)).^(1-a(13))))+ ...
> a(14)./(1i*2*pi*X*e0);
If you have the answer to this one, tell me. (even just for brainstorming)