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 for Programming
 Forum for Origin C
 Heavyside function
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

ablaszczuk

Poland
5 Posts

Posted - 02/11/2011 :  08:43:20 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
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

Penn

China
644 Posts

Posted - 02/11/2011 :  9:49:43 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi Artur Blaszczuk,

Please refer to this tutorial.

Penn
Go to Top of Page

ablaszczuk

Poland
5 Posts

Posted - 02/13/2011 :  2:41:08 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
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
Go to Top of Page

Penn

China
644 Posts

Posted - 02/13/2011 :  9:32:44 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
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
Go to Top of Page

ablaszczuk

Poland
5 Posts

Posted - 02/14/2011 :  05:32:13 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
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
Go to Top of Page

cpyang

USA
1406 Posts

Posted - 02/14/2011 :  1:05:09 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
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;}

Go to Top of Page

ablaszczuk

Poland
5 Posts

Posted - 02/16/2011 :  08:22:33 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
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
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