<div dir="ltr"><div class="gmail_default" style="font-family:georgia,serif">Hi Kurt,</div><div class="gmail_default" style="font-family:georgia,serif">Thank you very much for your insterest. I am sorry for this late answer. I was busy for days.</div><div class="gmail_default" style="font-family:georgia,serif">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. </div><div class="gmail_default" style="font-family:georgia,serif">Thank you very much again.</div><div class="gmail_default" style="font-family:georgia,serif">I wish healthy days...</div><div class="gmail_default" style="font-family:georgia,serif">Best Regards</div><div class="gmail_default" style="font-family:georgia,serif">Cüneyt</div><div class="gmail_default" style="font-family:georgia,serif"><br></div><div><div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr">----------------------------------------------------------------------------------------------------</div><div dir="ltr">Dr. M. Cüneyt HACIİSMAİLOĞLU<div><br></div><div><span style="font-family:arial,helvetica,sans-serif;font-size:small">|</span><font face="courier new, monospace" style="font-size:x-small;font-style:italic"> BURSA ULUDAĞ ÜNİVERSİTESİ </font><span style="font-family:arial,helvetica,sans-serif;font-size:small">|</span><font face="courier new, monospace" style="font-size:x-small;font-style:italic"> </font><i style="font-family:"courier new",monospace;font-size:x-small">FEN EDEBİYAT FAKÜLTESİ </i><span style="font-family:arial,helvetica,sans-serif;font-size:small">|</span></div><div><span style="font-family:arial,helvetica,sans-serif;font-size:small">|</span><font face="courier new, monospace" style="font-size:x-small;font-style:italic"> FİZİK BÖLÜMÜ </font><span style="font-family:arial,helvetica,sans-serif;font-size:small">|</span><font face="courier new, monospace" style="font-size:x-small;font-style:italic"> </font><i style="font-family:"courier new",monospace;font-size:x-small">16059 </i><span style="font-family:arial,helvetica,sans-serif;font-size:small">|</span><i style="font-family:"courier new",monospace;font-size:x-small"> BURSA / TÜRKİYE </i><span style="font-family:arial,helvetica,sans-serif;font-size:small">|</span></div><div><span style="font-family:arial,helvetica,sans-serif;font-size:small">|</span><i style="font-family:"courier new",monospace;font-size:x-small"> <b>Tel:</b> +90.224.2941708 </i><span style="font-family:arial,helvetica,sans-serif;font-size:small">|</span> <i style="font-family:"courier new",monospace;font-size:x-small"><b>Faks:</b> +90.224.2941899 </i><span style="font-family:arial,helvetica,sans-serif;font-size:small">|</span><i style="font-family:"courier new",monospace;font-size:x-small"> </i><i style="font-family:"courier new",monospace;font-size:x-small"><a href="mailto:mcuneyt@uludag.edu.tr" target="_blank">mcuneyt@uludag.edu.tr</a> </i><span style="font-family:arial,helvetica,sans-serif;font-size:small">|</span></div><div><span style="font-family:arial,helvetica,sans-serif;font-size:small">----------------------------------------------------------------------------------------------------</span></div></div></div></div></div></div></div></div><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sun, Oct 10, 2021 at 2:17 PM pro Fit Support <<a href="mailto:profit@quansoft.com">profit@quansoft.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div style="overflow-wrap: break-word;">Dear Cüneyt<div><br></div><div>This message got caught in my spam filter, so I am late to reply.</div><div><br></div><div>Your question is a good one, and the reply might be of general interest.</div><div><br></div><div>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).</div><div><br></div><div><br></div><div><br></div><div><br></div><div>The <b>intuitive approach</b> is to use a root solver algorithm to solve the diode equation, i.e. to calculate the root of</div><div><br></div><div>I - Is*exp(q*(V-I*Rs)/(n*k*T)-1) - (V-I*Rs)/Rp</div><div><br></div><div>i.e. to find the value of I where this equation returns zero.</div><div><br></div><div>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:</div><div><br></div><div>————</div><div><br></div><div>## function DiodeModelFunction<br><br>## input 1e-12, active, 'Is'<br>## input 0, active, 'Rs'<br>## input 100, active, 'Rp'<br>## input 300, active, 'T'<br>## input 1, active, 'n'<br><br>import math<br>from scipy import optimize<br><br>k = 1.380649e-23<br>q = 1.602176634e-19 <br><br><br>def f(I, V, Is, Rs, Rp, T, n):<br> global k, q<br> return I - Is * math.exp(q *(V-I*Rs)/(n*k*T)-1) - (V-I*Rs)/Rp<br><br><br>def DiodeModelFunction(x, Is, Rs, Rp, T, n):<br> global k, q<br> Imax = 2 * (Is * math.exp(q*x/(n*k*T) - 1) + x / Rp) ## estimate for an upper limit of I<br> sol = optimize.root_scalar(f, bracket = [-1, Imax], args = (x, Is, Rs, Rp, T, n), method = 'brentq')<br> return sol.root<br><span style="color:rgb(0,0,0)"><br></span></div><div>————</div><div><br></div><div>(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.)</div><div><br></div><div><div style="color:rgb(0,0,0)">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.</div></div><div style="color:rgb(0,0,0)"><br></div><div style="color:rgb(0,0,0)"><br></div><div style="color:rgb(0,0,0)"><br></div><div style="color:rgb(0,0,0)"><br></div><div>The <b>non-intuitive approach</b> is to define a function that should return zero:</div><div><br></div><div><div><div style="color:rgb(0,0,0)">————</div></div></div><div><br></div><div>## function ImplicitDiodeFunction<br><br>## input 0, inactive, 'I'<br>## input 1e-12, active, 'Is'<br>## input 0, active, 'Rs'<br>## input 100, active, 'Rp'<br>## input 300, active, 'T'<br>## input 1, active, 'n'<br><br>k = 1.380649e-23<br>q = 1.602176634e-19 <br><br><br>import math<br><br>def ImplicitDiodeFunction(x, I, Is, Rs, Rp, T, n):<br> global k, q<br> return I - Is * math.exp(q *(x-I*Rs)/(n*k*T)-1) - (x-I*Rs)/Rp<br><br></div><div><div><div style="color:rgb(0,0,0)">————</div></div></div><div><br></div><div>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.</div><div><br></div><div>Now you can fit the <font color="#000000">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.</font></div><div><font color="#000000"><br></font></div><div><font color="#000000"><br></font></div><div><font color="#000000">Best</font></div><div><font color="#000000"><br></font></div><div><font color="#000000">Kurt</font></div><div><font color="#000000">QuantumSoft</font></div><div><br></div><div><br></div><div><br><div><br><blockquote type="cite"><div>On 8 Sep 2021, at 20:21, Dr. M. Cuneyt Haciismailoglu <<a href="mailto:mcuneyt@uludag.edu.tr" target="_blank">mcuneyt@uludag.edu.tr</a>> wrote:</div><br><div><div dir="ltr"><div class="gmail_default" style="font-family:georgia,serif">Hi, </div><div class="gmail_default" style="font-family:georgia,serif">Has anybody tried to fit an implicit function? My function is diode equation:</div><div class="gmail_default" style="font-family:georgia,serif">I=Is*(exp(q*(V-I*Rs)/(n*k*T)-1)+(V-I*Rs)/Rp</div><div class="gmail_default" style="font-family:georgia,serif">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.</div><div class="gmail_default" style="font-family:georgia,serif">Thanks in advance</div><div class="gmail_default" style="font-family:georgia,serif"><br></div><div class="gmail_default" style="font-family:georgia,serif">cüneyt</div><div><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><br></div></div></div></div></div></div>
_______________________________________________<br>proFit-list mailing list<br><a href="mailto:proFit-list@quantum-soft.com" target="_blank">proFit-list@quantum-soft.com</a><br><a href="http://quantum-soft.com/mailman/listinfo/profit-list_quantum-soft.com" target="_blank">http://quantum-soft.com/mailman/listinfo/profit-list_quantum-soft.com</a><br></div></blockquote></div><br></div></div>_______________________________________________<br>
proFit-list mailing list<br>
<a href="mailto:proFit-list@quantum-soft.com" target="_blank">proFit-list@quantum-soft.com</a><br>
<a href="http://quantum-soft.com/mailman/listinfo/profit-list_quantum-soft.com" rel="noreferrer" target="_blank">http://quantum-soft.com/mailman/listinfo/profit-list_quantum-soft.com</a><br>
</blockquote></div>