Get Help

Turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

- Community
- :
- PTC Mathcad
- :
- PTC Mathcad
- :
- Fit double exponencial

Options

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

08-22-2018
12:23 PM

08-22-2018
12:23 PM

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

Solved! Go to Solution.

Labels:

1 ACCEPTED SOLUTION

Accepted Solutions

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

08-22-2018
02:14 PM

08-22-2018
02:14 PM

> 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!?

14 REPLIES 14

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

08-22-2018
12:52 PM

08-22-2018
12:52 PM

Re: Fit double exponencial

The best tool for this problem is the MinErr function!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

08-22-2018
01:45 PM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

08-22-2018
02:40 PM

08-22-2018
02:40 PM

Re: Fit double exponencial

… and than a line!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

08-22-2018
03:03 PM

08-22-2018
03:03 PM

Re: Fit double exponencial

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.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

08-22-2018
02:58 PM

08-22-2018
02:58 PM

Re: Fit double exponencial

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.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

08-22-2018
03:14 PM

08-22-2018
03:14 PM

Re: Fit double exponencial

@M_U wrote:

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

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

08-22-2018
05:16 PM

08-22-2018
05:16 PM

Re: Fit double exponencial

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.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

08-22-2018
02:14 PM

08-22-2018
02:14 PM

> 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!?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

08-22-2018
03:00 PM

08-22-2018
03:00 PM

Re: Fit double exponencial

REALLY interesting:

Look at the functions.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

08-22-2018
03:07 PM

08-22-2018
03:07 PM

Re: Fit double exponencial

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.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

08-22-2018
04:51 PM

08-22-2018
04:51 PM

Re: Fit double exponencial

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.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

09-05-2018
08:05 AM

09-05-2018
08:05 AM

Re: Fit double exponencial

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

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

09-05-2018
12:28 PM

09-05-2018
12:28 PM

Re: Fit double exponencial

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.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

09-10-2018
08:15 AM

09-10-2018
08:15 AM

Re: Fit double exponencial

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