Skip to main content
1-Visitor
July 11, 2021
Question

genfit() to solve for nonlinear parameters

  • July 11, 2021
  • 3 replies
  • 2181 views

How to use genfit() to solve for nonlinear parameters since it is hard to separate I or V from the equation?

3 replies

21-Topaz II
July 11, 2021

Hi,

genfit will not fit a function of two variables?

 

You need six constants to solve the problem.

 

Here is a solve block that gets close.

Capture.JPG

25-Diamond I
July 11, 2021

Why not consider ALL data and use "minerr" instead of "find":

Werner_E_1-1626014185051.png

 

 

But the result is only satisfactory if the guess for q (which does not seem to be changed by the solve block) is set to 0:

Werner_E_2-1626014345759.png

The whole thing is quite dependent on the guess values - as an example try changing the guess for A and look how the other values change.

 

 

23-Emerald IV
July 11, 2021

In this equation you cannot choose the value of q freely.  It's value should be the electron charge (while k is the Boltzmann constant, and T is the absolute temperature). It makes that k*T/q is about 25 mV.

 

Note that you can write V as an explicit function of I and the other parameters:

LucMeekes_0-1626087041216.png

Or, in other words:

LucMeekes_3-1626087290743.png

where W is the LambertW function (relation).

The LambertW(z) function is the solution of w, with given z to the problem:

LucMeekes_2-1626087176139.png

It is (only symbolically) available in Mathcad 15. Attached is a Mathcad 11 sheet with a numeric approximation of the function. I hope it works in 15.

 

Success!
Luc

 

 

21-Topaz II
July 12, 2021

For completeness sake here is solution with q set to electronic charge value.

You can use genfit() with Luke's formula.

Cheers

 

25-Diamond I
July 12, 2021

You can use genfit() with Luke's formula.


Not out of the box! The LambertW function in MC15 is a symbolic only function and can't be used with genfit. However, one should find numerically evaluable implementations of the LambertW function in some older threads here in the forum, if that should be the desired way to go.