Author |
Topic |
|
noldeorigin
USA
2 Posts |
Posted - 03/20/2020 : 11:39:09 AM
|
Origin Ver. and Service Release (Select Help-->About Origin): OriginPro 2015 Operating System: Windows 10
I'm using a piecewise non-linear function and the fits are not continuous across the meeting point of the two pieces (z=zc). I had assumed that the fitting algorithm would check for continuity between the pieces.
Is there a way to force continuity? Unfortunately, the functions don't allow for an easy linear constraint to maintain continuity.
Function: [Formula] if (z<=zc) x = x1/(1 + exp(-(z-zc)/L1)); else x = x2 - x2/(1 + exp(-(z-zc)/L2));
[Constraints] x2 > x1; L2 > L1;
Example of resulting fits:
Thanks! |
|
YimingChen
1592 Posts |
Posted - 03/20/2020 : 2:30:44 PM
|
Hi,
By solving the equation fL(zc) = fR(zc) at the boundary, you can solve x1 as a function of x2, L1, L2. Then replace x1 with this expression. (x1 need to be removed from parameter list now). See if that works.
James
|
|
|
noldeorigin
USA
2 Posts |
Posted - 03/20/2020 : 3:34:43 PM
|
Thank you for your advice.
I accidentally left out part of the formula, which really complicates the problem, the formula should be (where N is a constant):
if (z<=zc) y1 = x1/(1 + exp(-(z+N-zc)/L1)); else y2 = x2 - x2/(1 + exp(-(z-N-zc)/L2));
Unfortunately, I don't think that eliminating x1 will help ensure that y1 and y2 will be equal at z=zc.
I'd expect that there would be a way to make sure that piecewise functions are always continuous.
J
quote: Originally posted by YimingChen
Hi,
By solving the equation fL(zc) = fR(zc) at the boundary, you can solve x1 as a function of x2, L1, L2. Then replace x1 with this expression. (x1 need to be removed from parameter list now). See if that works.
James
|
|
|
YimingChen
1592 Posts |
Posted - 03/23/2020 : 1:59:46 PM
|
Hi,
If you solve the equation at the boundary, you get x1 = x2*exp(N/L2)/(1+exp(N/L2))*(1+exp(-N/L1)), Replace x1 in first equation and then fit. See figure below.
James |
|
|
|
Topic |
|
|
|