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
 Origin Forum
 Split Pseudo-Voigt 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

tayyeeyan

Singapore
6 Posts

Posted - 04/12/2008 :  07:21:19 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Origin Version (Select Help-->About Origin): 7.5
Operating System: XP

Hi, I am trying to customize my peak fitting function in the advanced fitting wizard of the non-linear fitting. My code goes like this

if (x<xc)

y = y0 + (2/(1+ ((n1*2*sqrt(ln(2)/PI)/w1) + (1-n1)*(2*w1/PI))/((n2*2*sqrt(ln(2)/PI)/w2) + (1-n2)*(2*w2/PI))))*(n1*(((2*(sqrt(ln(2)/PI))/w1)*exp((-4*ln(2)*(x-xc)^2)/(w1^2)))) +(1-n1)*(2*w1/PI)*(1/(1+4*(x-xc)^2)));

else

y = y0 + ((2*((n1*2*sqrt(ln(2)/PI)/w1) + (1-n1)*(2*w1/PI))/((n2*2*sqrt(ln(2)/PI)/w2) + (1-n2)*(2*w2/PI)))/(1+((n1*2*sqrt(ln(2)/PI)/w1) + (1-n1)*(2*w1/PI))/((n2*2*sqrt(ln(2)/PI)/w2) + (1-n2)*(2*w2/PI))))*(n2*(((2*(sqrt(ln(2)/PI))/w2)*exp((-4*ln(2)*(x-xc)^2)/w2^2))) +(1-n2)*(2*w2/PI)*(1/(1+4*(x-xc)^2)));

n1, n2, w1, w2, y0 is the variable.
When i compile, i got an error that says
'Variable "(2*(sqrt(ln(2)/3.1415926535897932384626))/w1)*exp((-4*ln(2)*(x-xc)^2)/(w1^2))" not declared"

may i know what does it means and how can i solve this problem?

Thanks a lot in advance first!

;)


larry_lan

China
Posts

Posted - 04/14/2008 :  05:49:10 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi:

You'd better define some temporary variables and use short expressions in your function, such as:


double temp1 = sqrt(ln(2)/PI)/w1;
double temp2 = 4*pow( (x-xc), 2 );
if(xc<0)
{
y = temp1 + temp2;
}
else
{
y = temp1 * temp2;
}


Or, it's very easy to make mistakes.

Thanks
Larry
OriginLab Technical Services

Edited by - larry_lan on 04/14/2008 05:59:00 AM
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