help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: fitting functions which contain 'i': more details


From: Jaroslav Hajek
Subject: Re: fitting functions which contain 'i': more details
Date: Mon, 9 Feb 2009 09:23:29 +0100

On Fri, Feb 6, 2009 at 5:20 PM, Harbinson, Jeremy
<address@hidden> wrote:
>
> Hi,
> The function I need to fit is one that describes the frequency dependence of 
> the electrical impedance (Z) of biological tissue in terms of four parameters:
> capacitance,
> two limiting resistances, and
> alpha, which basically compensates for the fact that biological materials do 
> not behave as ideal Resistor-Capacitor systems.
>
> It is difficult to clearly write the function here as it has lots of 
> subscripts etc, but here is the function in Latex:
>
> Z\left(freq\right)=R_{\infty}+\frac{R_{0}-R_{\infty}}{1+i\omega 
> C\left(R_{0}-R_{\infty}\right)^{\alpha}}
>
> C is capacitance, and R0 and Rinfinity are the limiting resistances.
>
> If C is non-zero the function returns an complex number that contains the 
> real and imaginary  parts of the impedance. If the real and imaginary parts 
> of the impedance are plotted against each other (real on x, imaginary on y) 
> the result is a so-called Cole-Cole plot. I think it is also sometimes called 
> a Nyquist diagram.
>
> The data I collect is the complex impedance (Z) as a function of frequency 
> (omega). I would like to estimate the parameters R0, Rinfinity, C and alpha 
> from this data by the fitting the above function to it. So I need some 
> fitting tool that is happy working with complex numbers. I have a 
> recollection that this is/was possible with a function in the basic Matlab 
> package, but I do not know which.
>
> An alternative approach to fitting the function above is to fit the Cole-Cole 
> plot (the real and imaginary components plotted against each other) with a 
> circle, as the locus of the points on a Cole-Cole plot is a chord or 
> semicircle whose centre is shifted away from the origin of the graph. 
> Problems with this approach are that the least-squares fitting routine does 
> not (so far as I know) fit parametric equations (maybe fsolve does?) and real 
> data often deviates from the chord/semicircle of the ideal Cole-Cole plot 
> (typical biology - we are not ideal). These distorted responses are 
> relatively easy to deal with by tweaking the basic function shown above, but 
> not so easy to work with via the graphical approach of the Cole-Cole plot.
> Hope this clarifies things a bit,
> all the best,
> Jeremy
>

Hi,
sorry for the dealyed answer; for some reason this post got separated
from the original thread.
Now, pardon my physics ignorance - I assume capacitance and resistance
are real numbers?

In that case, you are facing a complex fit in real variables (or,
equivalently, an overdetermined system of complex equations in real
vars).
In this case, there's little else you can do than to simply split each
complex equation into real and imaginary part, and solve that real
system. Any function that can handle this kind of fit is most probably
doing the same, so it's a purely convenience issue. The same can, of
course, be done for complex eqs in complex vars, but here this is
sub-optimal if the equations posess a complex derivative.

assuming you have the frequency and impedance observations stored as
two vectors, omega and Z (Z is complex),
you can do something akin to (untested yet):

function r = impedance_fit (vars)
  global omega, Z, alpha;
  Rinf = vars(1);
  R0 = vars(2);
  C = vars(3);
  r = Z - Rinf - (R0 - Rinf) ./ (1 + i*omega * (R0 - Rinf)^alpha);
  # turn complex system into real one
  r = [real (r); imag (r)];  # assumes omega is column vector
endfunction

...
[vars, res, info] = fsolve (@impedance_fit, vars_guess);

if you send me your data, I'll try to do the fit with fsolve for you.
(or you can compile the development sources and try yourself).

cheers


-- 
RNDr. Jaroslav Hajek
computing expert
Aeronautical Research and Test Institute (VZLU)
Prague, Czech Republic
url: www.highegg.matfyz.cz



reply via email to

[Prev in Thread] Current Thread [Next in Thread]