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
 2-part fitting function using Y-script
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

aeolian1

Germany
Posts

Posted - 02/05/2008 :  09:21:07 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Origin Version (Select Help-->About Origin): 6.1
Operating System: Windows XP

Hello,

I am attempting to use a Y-script in Origin 6.1 to define a two-part user-defined fitting function which has one form for x<0 and another for x>=0. As a simple example, I tried first to define an asymmetric Gaussian which has one width for x<0 and another for x>=0. Unfortunately, despite using the Labtalk syntax found in answers on this Forum, I keep getting the error message which tells me my function isn't generating values and that I should check for syntax errors and check the option for using a Y-script. (BTW, the desired syntax seems to vary somewhat depending on where I look on the Web; I tried many minor variants, e.g. with curly brackets around the "y=" statements, without the final ";", etc.) Could you please point out my error? I am getting rather desperate...

The function definition file is the following:

[GENERAL INFORMATION]
Function Name=AsymGauss
Brief Description=user95
Function Source=N/A
Function Type=User-Defined
Function Form=Y-Script
Number Of Parameters=5
Number Of Independent Variables=1
Number Of Dependent Variables=1
Analytical Derivatives for User-Defined=Off


[FITTING PARAMETERS]
Naming Method=User-Defined
Names=y0,A,xc,w1,w2
Meanings=?
Initial Values=--(V)
Lower Bounds=--(X,OFF)
Upper Bounds=--(X,OFF)
Number Of Significant Digits=


[FORMULA]
if (x<0.0) y=yo+A*exp(-4*ln(2)*((x-xc)/w1)^2);
else y=yo+A*exp(-4*ln(2)*((x-xc)/w2)^2);


[CONSTRAINTS]
/*Enter general linear constraints here*/


[CONSTANTS]


[INITIALIZATIONS]
/*Scripts to be executed before fitting, a good place for complicated initialization.*/


[AFTER FITTING]
/*Scripts to be executed after fitting, a good place for generating results.*/


[INDEPENDENT VARIABLES]
x=


[DEPENDENT VARIABLES]
y=


[CONTROLS]
General Linear Constraints=Off
Initialization Scripts=Off
Scripts After Fitting=Off
Number Of Duplicates=N/A
Duplicate Offset=N/A
Duplicate Unit=N/A
Generate Curves After Fitting=Yes
Curve Point Spacing=Same X as Fitting Data
Generate Peaks After Fitting=Yes
Generate Peaks During Fitting=Yes
Generate Peaks with Baseline=Yes
Paste Parameters to Plot After Fitting=Yes
Paste Parameters to Notes Window After Fitting=Yes
Generate Residuals After Fitting=No
Keep Parameters=No


Thank you very much!!

aeolian1

Germany
Posts

Posted - 02/05/2008 :  09:29:40 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
OOPS! I accidentally typed "yo" where I meant "y0". Now everything works fine with my first-ever Y-Script-defined function, and I can stop banging my head against the wall. I'm sorry to have bothered you!
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