Community Tip - Need to share some code when posting a question or reply? Make sure to use the "Insert code sample" menu option. Learn more! X

Translate the entire conversation x

LeastSquaresFit usage for Foster Model parameters

VD_12953418
2-Explorer

LeastSquaresFit usage for Foster Model parameters

Hello all,

 

I'm trying to do a fit for the transient thermal impedance of a transistor based on a set of points that I extracted from a datasheet. At first, I tried to do a simple polyfit, but it seems that the fit can diverge to very high numbers or even go negative, which may not be acceptable in this case, since the thermal impedance is strictly positive.

I tried to do a fit similar to the Foster thermal model, based on R and C couples of values, that is usually used in the thermal models of electronic components. For that, I tried to use the LeastSquaresFit function, but it doesn't converge in my case, script attached below. 

Could anyone explain the reason for the divergence ? Is it the input data or the way it is used ?

In the case I try to separate R and C values to 2 vectors, should the guess vector be the stack of the R and C vectors ? The documentation of the function doesn't explain it in a clear way.

VD_12953418_0-1740502944096.png

Alternatively, in the case of a logarithmic regression, is it possible to unassign the units from variables when using linfit ? With t_pulse in seconds and Zth in °C/W, linfit says that the units are not compatible.

VD_12953418_1-1740503430663.png

I'm using Mathcad Prime 9.

 

5 REPLIES 5
LucMeekes
23-Emerald III
(To:VD_12953418)

Maybe you should first do a transformation: take the log of Zth and tpulse and try to fit that.

 

Success!
Luc

Can't answer your questions, but "out-of-the-box" Prime genfit() seems to fit your data.

 

Prime 9 file attached.

LucMeekes
23-Emerald III
(To:VD_12953418)

Genfit with the proper function creates a reasonable fit:

LucMeekes_0-1740522782138.png

LucMeekes_1-1740522809606.png

LucMeekes_2-1740522872404.png

plot the results:

LucMeekes_3-1740522901561.png

Note, the array a contains R0, C0, R1, C1,...

 

Success!
Luc

 

LucMeekes
23-Emerald III
(To:LucMeekes)

A small improvement (especially for the lower part of the graph) can be obtained by adding another section:

LucMeekes_0-1740594306793.png

LucMeekes_1-1740594332446.png

 

Success!
Luc

 

Werner_E
25-Diamond I
(To:VD_12953418)

Have added some comments in the attached file - maybe it helps.

 

basically you can't take the natural logarithm of a time quantity. The argument of the logarithm function must be dimensionless. The same applies to the exp function as well as sin or cos (apart from the pseudo-units rad or deg, which are dimensionless anyway).

 

I can't say why the built-in function "LeastSquareFit" fails - I have never used it myself.

In the attached file you find a fit using a solve block with "minerr", a fit using "genfit" and also a fit using "minize" on a user written sum of squared errors function.
I also tried a Weibull model as suggested by CurveExpert Pro, but the fit is worse.

 

I also found something what looks like a bug in Prime

Werner_E_0-1740538187695.png

The last three values definitely are wrong. But after a recalculation (F9) Prime shows the correct values. Strange!

Werner_E_1-1740538257453.png

 

 

 

Announcements

Top Tags