[proFit-list] about implicit function fitting
Dr. M. Cuneyt Haciismailoglu
mcuneyt at uludag.edu.tr
Wed Oct 13 05:55:50 CDT 2021
Hi Kurt,
Thank you very much for your insterest. I am sorry for this late answer. I
was busy for days.
Your answer is very helpful for me. Actually, I had tried to fit by using
python only but I could not get a satisfactory solution. So I have decided
to fit by Pro Fit as a last chance :). But in this case, I could not
succeed to implement the function to Pro Fit. I think, I can now, thanks to
you.
Thank you very much again.
I wish healthy days...
Best Regards
Cüneyt
----------------------------------------------------------------------------------------------------
Dr. M. Cüneyt HACIİSMAİLOĞLU
| BURSA ULUDAĞ ÜNİVERSİTESİ | *FEN EDEBİYAT FAKÜLTESİ *|
| FİZİK BÖLÜMÜ | *16059 *|* BURSA / TÜRKİYE *|
|* Tel: +90.224.2941708 *| *Faks: +90.224.2941899 *| *mcuneyt at uludag.edu.tr
<mcuneyt at uludag.edu.tr> *|
----------------------------------------------------------------------------------------------------
On Sun, Oct 10, 2021 at 2:17 PM pro Fit Support <profit at quansoft.com> wrote:
> Dear Cüneyt
>
> This message got caught in my spam filter, so I am late to reply.
>
> Your question is a good one, and the reply might be of general interest.
>
> There are basically two ways to fit an implicit function, one being
> intuitive and the other being less intuitive but more interesting (and
> probably faster if you have a slow function and a large number of data
> points).
>
>
>
>
> The *intuitive approach* is to use a root solver algorithm to solve the
> diode equation, i.e. to calculate the root of
>
> I - Is*exp(q*(V-I*Rs)/(n*k*T)-1) - (V-I*Rs)/Rp
>
> i.e. to find the value of I where this equation returns zero.
>
> To do so, I recommend using Python for defining the function and one of
> Python’s root finders (e.g. in SciPy) to find the root. The function
> basically looks like this:
>
> ————
>
> ## function DiodeModelFunction
>
> ## input 1e-12, active, 'Is'
> ## input 0, active, 'Rs'
> ## input 100, active, 'Rp'
> ## input 300, active, 'T'
> ## input 1, active, 'n'
>
> import math
> from scipy import optimize
>
> k = 1.380649e-23
> q = 1.602176634e-19
>
>
> def f(I, V, Is, Rs, Rp, T, n):
> global k, q
> return I - Is * math.exp(q *(V-I*Rs)/(n*k*T)-1) - (V-I*Rs)/Rp
>
>
> def DiodeModelFunction(x, Is, Rs, Rp, T, n):
> global k, q
> Imax = 2 * (Is * math.exp(q*x/(n*k*T) - 1) + x /
> Rp) ## estimate for an upper limit of I
> sol = optimize.root_scalar(f, bracket = [-1, Imax], args = (x, Is, Rs,
> Rp, T, n), method = 'brentq')
> return sol.root
>
> ————
>
> (Not sure if I used a good guess for Imax: It should be an estimate for
> the current that is higher than the true current. You might also use a high
> enough constant value there.)
>
> Note: This only works if you have SciPy installed with your Python. If you
> don’t have that, you can use Pascal scripting and the Analyze(…) function,
> but that’s slightly trickier. Let me know if you need help with that.
>
>
>
>
> The *non-intuitive approach* is to define a function that should return
> zero:
>
> ————
>
> ## function ImplicitDiodeFunction
>
> ## input 0, inactive, 'I'
> ## input 1e-12, active, 'Is'
> ## input 0, active, 'Rs'
> ## input 100, active, 'Rp'
> ## input 300, active, 'T'
> ## input 1, active, 'n'
>
> k = 1.380649e-23
> q = 1.602176634e-19
>
>
> import math
>
> def ImplicitDiodeFunction(x, I, Is, Rs, Rp, T, n):
> global k, q
> return I - Is * math.exp(q *(x-I*Rs)/(n*k*T)-1) - (x-I*Rs)/Rp
>
> ————
>
> Then, prepare a data window that has three columns, the first one with the
> x (voltage) values, the second one with the values of the current, and the
> third one all zeroes.
>
> Now you can fit the ImplicitDiodeFunction to this dataset using the first
> and second column for x and I and the third one (the zeroes) as the
> y-value. This also allows you to fit the parameters. You can’t plot this
> function, though.
>
>
> Best
>
> Kurt
> QuantumSoft
>
>
>
>
> On 8 Sep 2021, at 20:21, Dr. M. Cuneyt Haciismailoglu <
> mcuneyt at uludag.edu.tr> wrote:
>
> Hi,
> Has anybody tried to fit an implicit function? My function is diode
> equation:
> I=Is*(exp(q*(V-I*Rs)/(n*k*T)-1)+(V-I*Rs)/Rp
> where q, k and T are known constants, V is independent variable, I is
> dependent variable and Is, n, Rs and Rp are parameters to be estimated.
> Thanks in advance
>
> cüneyt
>
> _______________________________________________
> proFit-list mailing list
> proFit-list at quantum-soft.com
> http://quantum-soft.com/mailman/listinfo/profit-list_quantum-soft.com
>
>
> _______________________________________________
> proFit-list mailing list
> proFit-list at quantum-soft.com
> http://quantum-soft.com/mailman/listinfo/profit-list_quantum-soft.com
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://quantum-soft.com/pipermail/profit-list_quantum-soft.com/attachments/20211013/74e5aa01/attachment-0001.html>
More information about the proFit-list
mailing list