Complex non-linear least squares fitting of impedance data

8 views (last 30 days)
Hi,
I am trying to fit measured impedance complex data to an equation using fminsearch. I am using the following function to which locate the minimum:
function impedance_function=impedance_model(x,omega,ReData,ImData)
Zcpe=(1./(x(2))).*((1i.*omega).^(-x(3)));
Z=Zcpe+x(1);
obj=((ReData-real(Z)).^2)./abs(ReData)+((ImData-imag(Z)).^2)./abs(ImData);
impedance_function=sum(obj);
end
The problem that I am having is that the fitting is not robust and depends too much on the initial guess. I am not sure if there is something wrong with my function, I believe the equation to be minimised is correct for the case of complex data (but I am not fully certain). I am also not sure about how can I assess how good the fitting is.
Thanks!
  3 Comments
Victor Calero
Victor Calero on 19 Jan 2022
Yes, that is it. Omega is the independent variable for both datasets, the real and the imaginary part.
Star Strider
Star Strider on 19 Jan 2022
If the System Identification Toolbox is available, this is likely a trivial problem. Begin with idfrd and follow the documentation to identify it. Then use the compare function to see how well the model fits the data.

Sign in to comment.

Answers (1)

Matt J
Matt J on 19 Jan 2022
Edited: Matt J on 19 Jan 2022
Because your model function is linear with respect to x(1) and 1/x(2), it would be beneficial to download fminspleas,
Then, you only need a good initial guess x3Initial for the x(3) parameter.
xdata=omeaga(:);
ydata=[ReData(:);ImData(:)];
funlist={1, @(x3,omega) [real( (1i.*omega).^(-x3) ) ; imag( (1i.*omega).^(-x3) ) ] };
[ILP,x3]=fminspleas(funlist, x3Initial, xdata, ydata);
x=[ILP(1), 1./ILP(2), x3];
  3 Comments
Matt J
Matt J on 19 Jan 2022
I think it's just a weighted least squares.
xdata=omeaga(:);
ydata=[ReData(:);ImData(:)]; ydata=ydata./sqrt(abs(ydata));
absRe=sqrt( abs(ReData) ); absIm=sqrt(abs(ImData));
funlist={1, @(x3,omega) [real( (1i.*omega).^(-x3) )./absRe ;...
imag( (1i.*omega).^(-x3) )./absIm ] };
[ILP,x3]=fminspleas(funlist, x3Initial, xdata, ydata);
x=[ILP(1), 1./ILP(2), x3];
Torsten
Torsten on 19 Jan 2022
The weighting for small data becomes too strong when dividing by absRe or absIm.
Either divide only the data for which absRe, absIm > 1 by this factor or let away this weighting in total.

Sign in to comment.

Categories

Find more on Physics in Help Center and File Exchange

Products

Community Treasure Hunt

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

Start Hunting!