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
 All Forums
 Origin Forum
 Origin Forum
 Making piecewise function fits continuous

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

Screensize:
UserName:
Password:
Anti-Spam Code:
Format Mode:
Format: BoldItalicizedUnderlineStrikethrough Align LeftCenteredAlign Right Horizontal Rule Insert HyperlinkUpload FileInsert Image Insert CodeInsert QuoteInsert List
   
Message:

* HTML is OFF
* Forum Code is ON
Smilies
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Clown [:o)]
Black Eye [B)] Eight Ball [8] Frown [:(] Shy [8)]
Shocked [:0] Angry [:(!] Dead [xx(] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
Check here to subscribe to this topic.
   

T O P I C    R E V I E W
noldeorigin 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!
3   L A T E S T    R E P L I E S    (Newest First)
YimingChen 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
noldeorigin 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 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

The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000