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
 All Forums
 Origin Forum
 Origin Forum
 2-part fitting function using Y-script

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

Screensize:
UserName:
Password:
Anti-Spam Code:
Format Mode:
Format: BoldItalicizedUnderlineStrikethrough Align LeftCenteredAlign Right Horizontal Rule Insert HyperlinkUpload FileInsert Image Insert CodeInsert QuoteInsert List
   
Message:

* HTML is OFF
* Forum Code is ON
Smilies
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Clown [:o)]
Black Eye [B)] Eight Ball [8] Frown [:(] Shy [8)]
Shocked [:0] Angry [:(!] Dead [xx(] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
Check here to subscribe to this topic.
   

T O P I C    R E V I E W
aeolian1 Posted - 02/05/2008 : 09:21:07 AM
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!!
1   L A T E S T    R E P L I E S    (Newest First)
aeolian1 Posted - 02/05/2008 : 09:29:40 AM
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!

The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000