T O P I C R E V I E W |
ablaszczuk |
Posted - 02/11/2011 : 08:43:20 AM OriginPro8 SRO V80724 Operating System:Vista Buisness
I would like implementation of Heavyside function h(x-a) into Rosin-Rammler function y=1-exp-((x-a)/b)^n)*h(x-a). In the case (x-a)>0 then h(x-a)=1, for (x-a)<0 h(x-a)=0. I cant create code builder for OriginC.
Artur Blaszczuk |
6 L A T E S T R E P L I E S (Newest First) |
ablaszczuk |
Posted - 02/16/2011 : 08:22:33 AM quote: Originally posted by cpyang
Your code clearly have mismatch parentheses, here is the corrected
if (x>a)
{y1=(m*(1-exp(-(x-a)/b)^n));} else {y1=0;}
if(x>c)
{y2=(r*(1-exp(-(x-c)/d)^g));} else {y2=0;}
Thank you so much for correction.
Artur Blaszczuk |
cpyang |
Posted - 02/14/2011 : 1:05:09 PM Your code clearly have mismatch parentheses, here is the corrected
if (x>a)
{y1=(m*(1-exp(-(x-a)/b)^n));} else {y1=0;}
if(x>c)
{y2=(r*(1-exp(-(x-c)/d)^g));} else {y2=0;}
|
ablaszczuk |
Posted - 02/14/2011 : 05:32:13 AM Thanks a lot for a direction.
I rebuild my code builder:
//---------------------------------------------------------- // void _nlsfDoubleRosinHeavyside2( // Fit Parameter(s): double a, double b, double n, double c, double d, double g, double m, double r, double y1, double y2, // Independent Variable(s): double x, // Dependent Variable(s): double& y) { // Beginning of editable part // Divide the curve by if condition. y = y1+y2; if (x>a) {y1=(m*(1-exp(-(x-a)/b)^n)} else {y1=0;} if(x>c) {y2=(r*(1-exp(-(x-c)/d)^g) else {y2=0;}
and I have a problem with compilation. I received meassage:Error, mismatching usage of parentheses 
Artur Blaszczuk |
Penn |
Posted - 02/13/2011 : 9:32:44 PM Hi Artur Blaszczuk,
You can first select the data whose Y values are between 0 and 1 from the graph by using this tool. And then do fitting.
Other way, you can mask the data that you don't want from the graph before fitting.
Penn |
ablaszczuk |
Posted - 02/13/2011 : 2:41:08 PM quote: Originally posted by Penn
Hi Artur Blaszczuk,
Please refer to this tutorial.
Penn
Hi Penn, Thank you very much for support. I created code builder in Origin C.
//---------------------------------------------------------- // void _nlsfCopyOfDoubleRosinHeavyside2( // Fit Parameter(s): double a, double b, double n, double c, double d, double g, double m, double r, double h, // Independent Variable(s): double x, // Dependent Variable(s): double& y) { // Beginning of editable part // Divide the curve by if condition. y = (m*(1-exp(-(x-a)/b)^n)*h)+(r*(1-exp(-(x-c)/d)^g)*h); if(x>a,c) { y = (m*(1-exp(-(x-a)/b)^n)*1)+(r*(1-exp(-(x-c)/d)^g)*1); } else { y = (m*(1-exp(-(x-a)/b)^n)*0)+(r*(1-exp(-(x-c)/d)^g)*0); } if(y>0) { y = (m*(1-exp(-(x-a)/b)^n)*h)+(r*(1-exp(-(x-c)/d)^g)*h); } else { y =0; } if(y<1) { y = (m*(1-exp(-(x-a)/b)^n)*h)+(r*(1-exp(-(x-c)/d)^g)*h); } else { y =1; } if(x>a,c) { h = 1; } else { h = 0; } // End of editable part }
How can I nonlinear curve fitting in range coordinate "y" (from y_min=0 to y_max=1)? 
Artur Blaszczuk |
Penn |
Posted - 02/11/2011 : 9:49:43 PM Hi Artur Blaszczuk,
Please refer to this tutorial.
Penn |
|
|