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
 fitting data with a piecewise defined function

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
frankwagner Posted - 03/10/2006 : 12:18:17 PM
Hello,
I desperately try to fit a piece wise defined function to my data, the limit between the two cases is a fit parameter, but Origin does not accept to vary this parameter.
I'm quite sure that many people already encountered and solved the problem. Could somebody help me to go faster with this?

For testing I use the function (origin C)
y=x^exponent;
if(x<limit){y=x*slope;}
with parameters: limit,slope,exponent

Frank
2   L A T E S T    R E P L I E S    (Newest First)
frankwagner Posted - 03/14/2006 : 07:20:00 AM
Hello,

finally it works. The thing is to program in a way that Origin "likes" it (no numerical problems in any case):

Examples:
1. This fits the data without error message (in spite of the numerical problems at F < thresh), but it does not take the points F < thresh into account at all.
double u; // argument of arctan
u = sqrt(F/thresh - 1);
p = 1.0 - exp(-defden *(u^3/6.0 + u - atan(u)) );

2. This does not work (error message upon fit), but should take the points F < thresh into account
double u = 0; // argument of arctan
u = sqrt(F/thresh - 1);
p = 0;
if (F> thresh)
{p = 1.0 - exp(-defden *(u^3/6.0 + u - atan(u)) );}

3. this works just fine
double u = 0; // argument of arctan
if ( F > thresh ) { u = sqrt(F/thresh - 1); }
p = 1.0 - exp(-defden *(u^3/6.0 + u - atan(u)) );

Bye, Frank
easwar Posted - 03/10/2006 : 1:50:49 PM
Hi Frank,

I tried the following example:
1> filled col 1 with 100 numbers: 0.1, 0.2....,10.0
2> used set col values formula for col 2 so that
col(2) = col(1) * 1.5 + ran()/3 for rows 1 thru 44
col(2) = col(1)^1.3 + ran()/3 for rows 45 thru 100
just to generate some data

3> I then defined a new fitting function using Origin C (in version 7.5) with parameters exponent, limit, and slope:
[code]
if( x < limit )
y = x * slope;
else
y = x^exponent;

[code]

4> Fitted the data with initial values set as
exponent = 1, limit = 4.5, slope = 1

I too encountered the problem where Origin suggested to fix the "limit" parameter. I then fixed it to 4.5 and did some iterations, and then went back and asked for the parameter to be varied and then it worked fine. Perhaps you could try that? If that does not work, please send the data and your FDF to tech support so they could take a look.

The following is the result that I got with the data above.

Easwar
OriginLab






Edited by - easwar on 03/10/2006 1:53:15 PM

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