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