Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
Fitting complex data from dielectric spectrum to a complex parametric model

Subject: Fitting complex data from dielectric spectrum to a complex parametric model

From: Benjamin

Date: 13 Feb, 2012 16:29:11

Message: 1 of 3

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);

Subject: Fitting complex data from dielectric spectrum to a complex parametric model

From: ron

Date: 30 Mar, 2012 22:01:26

Message: 2 of 3

"Benjamin " <benjaminst@gmail.com> wrote in message <jhbdon$4lc$1@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)

Subject: Fitting complex data from dielectric spectrum to a complex parametric model

From: Roger Stafford

Date: 31 Mar, 2012 03:16:12

Message: 3 of 3

"Benjamin " <benjaminst@gmail.com> wrote in message <jhbdon$4lc$1@newscl01ah.mathworks.com>...
> 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.
 - - - - - - - - -
  The documentation for 'lsqcurvefit' contains what is apparently the explanation for your difficulties. It states, under "Limitations", that "lsqcurvefit only handles real variables (the user-defined function must only return real values). When x has complex variables, the variables must be split into real and imaginary parts." See the Mathworks website at:

 http://www.mathworks.com/help/toolbox/optim/ug/lsqcurvefit.html

  I interpret that to mean that you will have to split both X and Y into real and imaginary parts and the same with d = myfun2(a,X). Your vectors will therefore have to be doubled in length. However your real-valued parameter vector 'a' is presumably all right as it stands.

Roger Stafford

Tags for this Thread

No tags are associated with this thread.

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us