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
 how to add function : exponential assoc 1 ?
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

taya

Indonesia
Posts

Posted - 04/26/2008 :  4:49:05 PM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Hello,

I try to add an exponential assoc order 1 function to the OriginPro 7.0, but I always get an error message when I try to use it to analyse my data. It is said that my parameters are not properly initialized. I do not have a good basic in C language, so I just try to modify the existing equation and its programming.

The equation I want to use is : y = y0 + A1*(1 - exp(-x/t1))

I try to use :
y0 = max( y_data );
x_y_curve = ln( x_y_curve );
double coeff[2];
fitpoly( x_y_curve, 1, coeff);
A1 = exp( coeff[0] );
t1 = -1.0 / coeff[1];

but I got an error message while I was try to execute and use it from the wizard.

I also try to use :
double ya = yatasymt(x_y_curve);
x_y_curve = ya - x_y_curve;
double coeff[4];
fitpoly(x_y_curve,3,coeff);
y0=ya-coeff[0];
x_y_curve=ln(x_y_curve);
fitpoly(x_y_curve,1,coeff);
A1=exp(coeff[0];
t1=-1.0/coeff[1];

but still I got an error message.

Can anyone help me??

Thanks in advance.

Echo_Chu

China
Posts

Posted - 04/30/2008 :  04:53:58 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi,

I have tried your initial code and it looks work fine. When you update the function, did you also update Parameter Names as "y0,A1,t1"?

When I try your initial codes.
First paragraph of codes does not work fine if there is negative value in dataset. I think it is because this line "x_y_curve = ln( x_y_curve );"


There is a mistake in 2nd paragraph of initial codes.

A1=exp(coeff[0]);

")" is missing in your origin codes. However, the initial codes work fine after ")" is added.

Echo
OriginLab Corp

Go to Top of Page

Pasiphae

Argentina
1 Posts

Posted - 02/07/2009 :  1:27:06 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi... Ive been having the same problem... the thing is I have no idea on how to write anything in C. I wanted to adjust my data to the following function:
y=(A+x)^B

Where both A and B are parameters I want to find. I know B varies between 0.3 and 0.4, but nothing on A.

I have no idea how to initialise properly my parameters or anything of the sort... so any help whould be great!
Thank you in advance!

"When the power of love overcomes the love of power the world will know peace" - Jimi Hendrix
Go to Top of Page

Deanna

China
Posts

Posted - 02/09/2009 :  02:15:26 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Most of the time, you can just try to give initial values for the parameters and see if you can get a good fit. In your case, I would try A=0.3, B=2 or something like that.

For writing initial code, the basic idea is to get some data points from the source data and set up equations to solve the parameter values.

Deanna
OriginLab Technical Services
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