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
 Continuous fits in mulitple range fitting
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

FS_S

Germany
4 Posts

Posted - 12/17/2012 :  10:10:39 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Origin Ver. and Service Release (Select Help-->About Origin): 8.6.0 SR3
Operating System: XP

Hey guys,

I try to fit three parts of one experimental dataset with three different polynomials. This is due to the shape of the curve which is nearly linear for small x-values, then becomes rather round-ish for medium x-values and nearly linear again for large x-values. All my ranges overlap in one datapoint, which means that, for example, my first range goes up to x=35 and my second range also starts with x=35.
I managed to select my three distinct ranges and also do the fitting with polynomials of variing degrees (using NLCF-dialog). Unfortunately, the best fitting curves do not have the same y-values at these overlaping points which makes the overall fit non-continous at these points.
No here is my question: Is there a way to force the fitting algorithm to make all fitting curves continuous (and maybe even differentiable) at these overlaping points?

Thanks in advance
Frank

Cecilia_syy

65 Posts

Posted - 12/18/2012 :  02:53:49 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi Frank,

You can define a piece-wise fitting function in the Fitting Function Organizer.
The Parameter Names are x1, y1, x2, y2, k1, k2.
The point (x1,y1) is the intersection of your first range and second range.
The point (x2,y2) is the intersection of your second range and third range.
k1, k2 represent the derivative at the point (x1,y1) and (x2,y2) respectively.

Use x1, y1, k1 to define the fitting function for the first range.
Use x2, y2, k2 to define the fitting function for the third range.
Use all the parameters to define a cubic polynomial for the second part.
Note that, the intersections and their first-order derivatives are continuous.

The body of the Function is:
-------------------------------------------------------------------
if(x<x1) 
		y = k1*(x-x1)+y1;	
	else if (x<x2)
		y = y1*(x-x2)/(x1-x2)+y2*(x-x1)/(x2-x1)+(k1-(y2-y1)/(x2-x1))*(x-x1)*(x-x2)^2/(x1-x2)^2+(k2-(y2-y1)/(x2-x1))*(x-x1)^2*(x-x2)/(x2-x1)^2;	
	else 
		y=k2*(x-x2)+y2;

----------------------------------------------------------------------
You need to fix x1 and x2 in Parameter Settings with your data range intersections.

Save this user-defined fitting function. Then you can use this fitting function to do the fitting after initializing the parameters in the NLFit-dialog.

Cecilia
Originlab Corp.

Edited by - Cecilia_syy on 12/18/2012 05:42:45 AM
Go to Top of Page

FS_S

Germany
4 Posts

Posted - 12/18/2012 :  06:07:18 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi Cecilia,

Thanks for the hint. It put me in the right direction to do the "matching" by simple math.

Regards
Frank
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