The Origin Forum
File Exchange
Try Origin for Free
The Origin Forum
Home | Profile | Register | Active Topics | Members | Search | FAQ | Send File to Tech support
Username:
Password:
Save Password
Forgot your Password? | Admin Options

 All Forums
 Origin Forum
 Origin Forum
 Problem with my own exp fitting function
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

marasneo

Poland
9 Posts

Posted - 04/20/2015 :  11:08:42 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Hi!
I have tried to modify standard Origin ExpDecay2 function to solve equation like this:

Z=C0+C1*exp(x1*t)+C2*exp(x2*t)

where t is my x (independent variable) and Z is dependent (y)
I am interested in determination of x1 and x2 roots which should be always negative.
Unfortunately, after fitting, they are always positive. Probably I am doing something wrong...

There is my modified code below (probably with errors). I need to take into account also the offset x0 (I do not know if the formula will be the same as for ExpDecay2 or not).

Always before each fitting I am just setting the Auto Parameter Initialization and checking "fixed" for C0 and x0 offset values (the same for function like ExpDecay2 - is it ok?).

FUNCTION

C0 + C1*exp(-(x-x0)*ex1) + C2*exp(-(x-x0)*ex2)

PARAMETER INIT

x0 = min(x_data);
int sign;
ex1 = get_exponent(x_data, y_data, &C0, &C1, &sign);
if (ex1 > 0)
{
int nSize = x_data.GetSize();
C0 = y_data[0] + y_data[nSize-1] - C0;
C1 = C2 = -0.5 * sign * exp(C1+ex1*(x_data[0]+x_data[nSize-1])-x0*ex1);
ex1 = ex2 = 1 / ex1;
}
else
{
ex1 = ex2 = -1 / ex1;
C1 = C2 = 0.5 * sign * exp(C1 - x0/ex1);
}


Please, help me with this problem.

JacquelineHe

287 Posts

Posted - 04/21/2015 :  04:27:59 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi,

In Origin ExpDecay2 function, the parameter is /ex1.
But in you new function, that is *ex1.

So it can not follow the ExpDecay2 function initialization code of those parameters.

Thanks
Jacqueline
OriginLab
Go to Top of Page
  Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000