cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Help us improve the PTC Community by taking this short Community Survey! X

Fit double exponencial

M_U
9-Granite
9-Granite

Fit double exponencial

Hello,

I want to set a function of type y = A1 + A2 * exp (-X / A3) + A4 * exp (-X / A4) to my data. I need to find the values ​​of Ai. I tried to use the genfit function and an error occurred. I saw in the forum that there are several tips, but I am a beginner in Mathcad, and would like some help. Attached follows the data I would like to perform my function.


Thank you

1 ACCEPTED SOLUTION

Accepted Solutions
Werner_E
24-Ruby V
(To:M_U)

> I tried to use the genfit function and an error occurred.

So why don't you attach your Mathcad sheet and show the error.

genfit and a solve block with minerr usually come up with the very same result.

Unfortunately they rely heavily on good guess values and may react quite sensible to changes of the guesses. This may be the reason for genfit failing in your try.

 

EDIT: I gave it a try, too, but Fred was faster.

The system is VERY sensible with respect to the guess values and the difference in the resulting values for Ai when changing the guesses are quite big.

Nevertheless I wonder why with Freds sheet I get values so much different from mine even when using the very same guesses!?

B.png

 

 

View solution in original post

14 REPLIES 14
ValeryOchkov
24-Ruby IV
(To:M_U)

The best tool for this problem is the MinErr function!

Fred_Kohlhepp
23-Emerald I
(To:M_U)

genfit applied

fit.png

… and than a line!

Valery, that data sure could be fitted in many quite different ways (some shown in the screenshots below).

But I guess that ulisses has good reasons to choose exactly the type of function he posted.

B1.pngB2.png

Thank you FredKohlhepp, I tested your program and it worked fine but when I compared the result to another program, for example, Origin, the data differed a lot. I will try other suggestions here. Thank you anyway.

Werner_E
24-Ruby V
(To:M_U)


@M_U wrote:

Thank you FredKohlhepp, I tested your program and it worked fine but when I compared the result to another program, for example, Origin, the data differed a lot. I will try other suggestions here. Thank you anyway.


So why don't you post your sheet and the expected results so we could compare the quality of the various fits?

 

Werner_E
24-Ruby V
(To:M_U)

Here's a comparison of "genfit" vs a solve block with "minerr".

As you can see in the screenshot below, the results are slightly different, but the quality of fit is the same for both (see the error calculations).

Again the results are quite sensitive wrt the guess values, but I wasn't able to find a better fit with different guesses.

B.png

Werner_E
24-Ruby V
(To:M_U)

> I tried to use the genfit function and an error occurred.

So why don't you attach your Mathcad sheet and show the error.

genfit and a solve block with minerr usually come up with the very same result.

Unfortunately they rely heavily on good guess values and may react quite sensible to changes of the guesses. This may be the reason for genfit failing in your try.

 

EDIT: I gave it a try, too, but Fred was faster.

The system is VERY sensible with respect to the guess values and the difference in the resulting values for Ai when changing the guesses are quite big.

Nevertheless I wonder why with Freds sheet I get values so much different from mine even when using the very same guesses!?

B.png

 

 

REALLY interesting:

Capture.PNG

Look at the functions.

Yes, I also just noticed that the e^x and exp(x) give different results.

If I define exp(x):=e^x in front of my sheet, I get the same results as your sheet.

After optical inspection it looks like the results with exp(x) give a better fit than e^x.

Crazy and unexplainable indeed.

Addendum:

Obviously exp(x) and e^x are implemented somewhat differently in Mathcads numerics.

Compared to the symbolics, exp(x) results are more precise than what e^x returns.

Interesting that those small percentage deviations have such an impact on the result of genfit.

B.png

M_U
9-Granite
9-Granite
(To:Werner_E)

Dear Werner_E,

is it possible to get the error in the values ​​obtained in the adjustment? I tried the Stdv function (A ^ t) but it did not work.
 Thank you

Werner_E
24-Ruby V
(To:M_U)

I am not sure what you mean by "error in the values ​​obtained in the adjustment"!?

My screenshot show how to calculate the the root of the MSE (mean squared error) and also how to get the same value after a solve block with "minerr" using the system variable ERR.

 

Don't know what you had in mind when you tried "Stdev(A^T)". After all the vector A consists simply of the five parameters/coefficients of your fit function.

 

M_U
9-Granite
9-Granite
(To:Werner_E)

Caro Werner_E

the error refers to the values ​​obtained in the constants of the adjustment, A0, A1 .... I am comparing the results obtained in mathcad with the results obtained in a graphic program called Kaleida, and in that are provided the value of each constant with its respective error, for example, A0 = 2.89 +/- 0.07. I would like to do this in mathcad to know what the errors are in each constant. I did a program in which I read several files and do the same procedure for each of them. I will attach the routine I have created.

Thank you

Top Tags