Re: Simulating electrochemical reactions with Mathematica
- From: Evgenij Barsukov <evgenij_b_no_spam@xxxxxxxxx>
- Date: Mon, 22 Aug 2005 15:17:21 -0500
Nick J. wrote:
"Mike Honeychurch" <M.Honeychurch@xxxxxxxxx> wrote in message news:BF2774F7.BBC%M.Honeychurch@xxxxxxxxxxxx
If the fortran code is supplied perhaps you could port it to matlab??
I was hoping Evgenij Barsoukov could say whether Andriy Gorkovenko (who
ported the DOS version of LEVM to Windows) or possibly somebody at Solartron
has ported the LEVM Fortran code to another language like C or C++.
Actually it would be very unpractical to rewrite the entire LEVM engine
in C. What we did in the past was to create a C++ wrapper program that
a) prepares an input file for LEVM
b) calls LEVM from a C++ interface.
c) analyses the output that LEVM produces and visualizes on screen and/or splits the parameters and fit data in separate files for further
processing
I guess the same thing could be done in Matlab. You could write a wrapper function that would be called from Matlab and do all this things
except fit data and parameters would not be saved as files but instead
returned to Matlab as arrays.
Unfortunately both wrapper functions we made before are for commercial
programs (MEISP and LEVM for Windows) so they can not be freely distributed. But making it is rather straightformard. There are also additional utility programs written by me which are free and come
with standard distribution of DOS LEVM (mklio and extlevm) that do steps a) and c) and so they themself could be called from a wrapper function to simplify the management of rather tricky LEVM input/output format.
If thats
already been done, then porting it to Matlab would be a lot easier since M-code resembles C/C++ a lot more than Fortran. Evgenij might know if this is the case because he is coauthor with J. Ross Macdonald of the latest edition of the book, Impedance Spectroscopy (see link below) and he contributed some of the utilities included with the LEVM package.
http://www.amazon.com/exec/obidos/ASIN/0471647497/rossmacdonsho-20/104-7439666-3084705?creative=327641&camp=14573&link_code=as1
If LEVMW was available in C++, it might be more accessible to a broader audience. Although C++ doesn't have a primitive complex numeric data type, classes are readily available to do complex number crunching.
Agreed. But at the other hand you could use the Levenberg-Marquat algorithm directly in Mathematica if it exists there in complex form
(it does exist in Mathcad for example as genfit function). Than you would need to write your own function for the circuits you are fitting, but it is a good idea to know this equations anyway.
Specialy sucsessful would be the version of LM algorith which uses analytical derivatives of the fitted function rather than numericaly
calculated derivatives, as later are themself subject to
convergency problems.
Of cause it is a bit more hassle to enter analytical derivatives
manualy ( but not that much realy with the symbolic calculation
abilities of Mathematica or Mathcad).
Still LEVM remains a lot faster then any LM functions I tried in math-packages so I keep using it (or software that uses it like MEISP) for fitting series of files. Taking over the parameters produced from previous file in a series and using them as initial guesses for next file is a great way to achieve good convergency and fit things very fast.
Regards, Evgenij
Regards, Nick
.
- Follow-Ups:
- References:
- Simulating electrochemical reactions with Mathematica
- From: Mike
- Re: Simulating electrochemical reactions with Mathematica
- From: Nick J.
- Re: Simulating electrochemical reactions with Mathematica
- From: Evgenij Barsukov
- Re: Simulating electrochemical reactions with Mathematica
- From: Nick J.
- Re: Simulating electrochemical reactions with Mathematica
- From: Mike
- Re: Simulating electrochemical reactions with Mathematica
- From: www.DrHuang.com
- Re: Simulating electrochemical reactions with Mathematica
- From: Mike Honeychurch
- Re: Simulating electrochemical reactions with Mathematica
- From: Nick J.
- Re: Simulating electrochemical reactions with Mathematica
- From: Mike Honeychurch
- Re: Simulating electrochemical reactions with Mathematica
- From: Nick J.
- Simulating electrochemical reactions with Mathematica
- Prev by Date: Re: Electrolysis of aluminium anode and copper cathode with NaCl el...
- Next by Date: Re: Simulating electrochemical reactions with Mathematica
- Previous by thread: Re: Simulating electrochemical reactions with Mathematica
- Next by thread: Re: Simulating electrochemical reactions with Mathematica
- Index(es):