Plots the impedance DATA which has to be a 3-columns wise matrix [FREQ, RealZEXP, ImagZEXP]. Impedance, admittance, capacitance and modulus representations in the complex plane are then pushbutton obtainable.
The others usages are described in the help lines with examples too...
Yes the model string looks like correct however, I suggest to begin by simpler models then add new elements step by step. So you will get initial values and may check the model validity. To end, I am enough skeptic about a so much complicated model (with 13 parameters) could give values which have physical true meanings. if still problems, you may send me data. Have a good day, Jean-Luc
Good morning and thanks for your code.
I'm trying to model EIS with a complete impedance equivalent circuit 's(s(p(E1,R1),p(E1,s(R1,p(C1,R1)))),s(R1,p(C1,p(R1,s(R1,L1)))))'. It doesn't provide any values or fitting curve. I do not have any proper or precise values to input. Is the input model correct?
Thank you!! Now it works!!
Just put 's(s(R1,p(R1,C1)),p(p(R1,C1),L1))' as model string because all the elements only need one parameter. The next step is to enter the initial values as they come in the model string and comma separated.
Hoping that is helping,
Thank you for your amazing code!
I am trying to fit an equivalent circuit. I am using two arguments for s and p and everything the circuit seems correct 's(s(R0,p(R3,C3)),p(p(R4,C4),L4))'. However, there is the warning dialog "an error occured, the circuit string or pinit is bad defined, plese check them". Could the initial values be wrong?
Bonjour Bruno. Thanks you for your kind message.
I am very happy if some colleagues improve the code but I had no news from Jacopo since his 2016 coments. Yes indeed he was considering that "no bounds" would give better results. In my opinion, to get BETTER or not better results depends on the data and on the model (presence or not of small Z values, presence or not of CPE, ... which may have heavy influence on the fit process) . However it is expectable to get DIFFERENT results because to set bounds will mathematically change the f(p) target and the fit may converge to a different solution especially if the new target f(p) landscape is complex (has many local minima).
About the CPE, if the data is enough hum ... regular, in other words if the model is right, then I think it is not necessary to use bounds for the CPE exponent, it would be sufisient to furnish starting values in the [0 1] interval.
I didnt study these features ... Best Regards, Jean-Luc
Thank you so much Jean Luc.
Very nice code. I enjoyed the GUI version but this one is perfect for anyone who is comfortable with matlab. I was wondering if you were able to see the suggestions Jacopo Remondina provided. Was he considering that the fit was better if no bound restrictions were given as input? I am getting good results by just restricting some obvious variables such as the n power (N_Cpe) between 0 and 1 in the CPE elements. I also compared some fit results (made with Zfit) to other software such as Zview and got a good agreement. Have you made this study or published some article with this type of comparation by any means?
Thank you once again for providing us this code.
* The Khi2 definition is given in the ZfitGUI manual : https://drive.google.com/open?id=1_zryTSEnynGd_7FsXxFLj9H7J-gPqEWz. Dowload the manual, then open it with Word to read it properly (some formulae may disappear with other viewers; I will correct that soon).
* Fval from Zfit is the same : fval=Khi2, but only if the weigthing method is left as default : proportionnal. Otherwise, Fval is the value of the minimized function (which is the difference Ztheo versus Zexp) at the solution as stated in the fminsearch Matlab definition. Once again, some details which can help are given in the ZfitGUI manual.
Hi Dr. Dellis,
Thank you kindly for uploading this file - it works wonderfully. I see you have commented earlier that the FVAL is a measure of goodness of fit. I have a question with regard to that:
-Is there some mathematical relationship between FVAL and CHI^2? (I see that in ZfitGUI you calculate the CHI2 - we would like to calculate the CHI2 in the Zfit file).
To Allison : no sorry, these kind of optimizers must start with initial guesses. You may find them by analysis of the targeted data using "ZfitGUI", his manual and his tutorial also share in the file exchange Mathworks site. Regards, Jean-Luc
Is there a way to run this code and fit to circuit without inputting starting circuit parameters? The way I am trying to use this code - I may not know or have a good guess as to what to make the starting parameters.
Hi Allison. Please have a look on the help lines. The syntax is "[pbest,zbest,fval,exitflag,output]=Zfit(varargin)" where FVAL is a measure of the goodness of fit. Regards.
I get a wrong circuit simulation for series combination: for example the following code to generate the ZdB plot of a series RC
%circuit parameter definition, series combination of R & C
%plotting the Zdb in semilog plot
this code gives me
1) a fully imaginary impedance (which is not correct)
2) the module plotted has a notch, like series LC resonance (which doesn't make sense).
What am I missing?
Thanks a lot to Jean-Luc Dellis for providing this software to all. It will be much more helpful to the research scholars like me.
Could any one please explain, how to install this software in lab-tap. I downloaded this Zfit software, but i could not install it in my laptab. It would be highly helpful for my research work, if i could use this EIS fit software.
Very useful and helpful
Bonjour Jacopo, I just have received today the notification of your coments.
To answer your first coment, I think it could come from the starting values which must close the best ones when using CPE. Another hint is to try the "fitNP" string (fit Not Proportionnal). I mean a fit could appear badly completed when estimated by eyes on the Z spectrum when it is good when checking the sum (error(i)/Z(i)) given by the output parameter fval.
About your second and interressing coment, I would like to get the data and the modified code... in order to check by myself.
update for my previous post:
I modify a bit more your code, turning the function "fminsearchbnd" to "fminsearch" (creating a new function "curfitNoBound") if no bounds are provided to Zfit and now the fit is much better (actualy better then in EIS Spectrum Analyzer), so I suggest to avoid parameter transformation if possible
First of all, thanks for this program, it's gonna really help me.
Second: I think that I managed to improve your function so now p() and s() can work with any number of parameters (maybe not 0, but a check is easy to implement);
Third I have a question for you: I tried to fit a complex circuit: s(R1,s(p(E2,R1),p(E2,R1))) with some data, but I'he got a fit that was worste then the input parameters (obtained via EIS software analyzer and entered in your program with 3 significant digit). Any idea why?
how can i download it
Really useful tool, thanks!
Thank you very much for this function
Thank you very much for this function.
Did the world a big favor.
I was just wondering if it possible to easily obtain some sort of fitting statistic for each fitted parameter or just the whole fit in general.
Thank you very much!
Thank You, J. Dellis. It worked and ZfitGUI is too good, Working great ;)
1/ I tried your string and there was no error. I think the limit in the amount of elements is higher. So there is no problem to simulate data.
2/ Fitting experimental data with long strings will be an other task and you would beware of overparametrization (too many elements) leading to some parameter to have nonsensed values.
3/ I tried your string on some data and get the minimizer failed at the first try. As said in the help, I retried with the returned "pbest" as initial parameters and get the convergence. To end, I prompt you to use the "ZfitGUI" function which eases the data weigthing. Best regards.
Such a wonderful code.
I am trying for this string s(R1,p(C1,s(R1,p(C1,s(R1,p(R1,s(R1,C1))))))) , it doesn't work with more than 7 elements for the string ?
Thank you Jean-Luc, I wasn't aware that nesting is possible.I tried it and works perfectly!
This makes the code even more beautiful ;)
As the operators "s" and "p" require exactly 2 arguments s(a,b) and p(c,d), the code you writen : s(p(R1,C1),p(R1,C1),p(R1,C1))
is not correct and would be : s(s(p(R1,C1),p(R1,C1)),p(R1,C1))
Hoping that will help,
I noticed that s(p(R1,C1),p(R1,C1),p(R1,C1)) is not accepted so i expanded the parser with a 'c' (from 'c'hain ;) at the 's' postion and added the c function accepting 3 pararmeters. Maybe the 's' function can be modified using overloading accepting more arguments?
Beautiful code btw!
Really thank you for such a wonderful work. it is very helpful for processing a large amount of EIS data.
The operators s and p must have stricly 2 arguments. The operator s in the circuit string
has 4 arguments. Maybe you wanted :
When I am trying more complicated string like 's(R1,p(R1,E2),p(R1,E2),E2)', the programe seems not work?
Thank You !
For the reference, i suppose the author's name and the link to this page are sufficient.
Excellent software, thanks. What should I make the reference to if writing a Journal Paper?
A GUI is now available, please see ZfitGUI :
but still for MATLAB users because it is mandatory to write the fitting function. However, if no fitting is needed, checking the Z, Y, C or the Modulus spectra is easy...
Working just grate. Simple for operation by MATLAB user, but a GUI is needed for others. Very fast, and really converge to the data (not as the commercial programs which come with EIS systems).
the way circuit is entered has been modified to ease the use
Inspired by: fminsearchbnd, fminsearchcon