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
 How to write a long function for fitting?

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
Meilongwei Posted - 04/15/2015 : 11:47:04 AM
Dear all:
I have another question.
My function is too long and could be express three short product as follows:
y=A*B*C
A=a1*x+b1^x+x^c1+d1
B=a2*x+b2^x+x^c2+d2
C=a3*x+b3^x+x^c3+d3

Here a1,b1,c1,a2,b2,c2,a3,b3,c3 are parameters I need fit.
I tried with C code form but failed.
How could I write such express?
Is Amanda here?
Thanks!

meilongwei
5   L A T E S T    R E P L I E S    (Newest First)
jasonzhao Posted - 04/17/2015 : 03:37:39 AM
Hello,

You can click F9 in Origin interface to open the Fitting Function Organizer, then blowse to User Defined folder left, select the functions unwanted, click remove to delete the items.

please refer to this page for further details.
http://www.originlab.com/doc/Origin-Help/FitFunc-Organizer


Best regards!
Jason
OriginLab Technical Service
Meilongwei Posted - 04/16/2015 : 10:05:22 PM
quote:
Originally posted by snowli

Hello,

In Fitting Function Builder, you can choose Function Type to be Equation. Then you can split the functions into multiple lines.

But remember to put the final y=..... at the end instead of at the beginning.



The hint on left panel says

---------------------------------------------------------
Function Type
---------------------------------------------------------
Select this option if you need multiple lines or you have more than one dependent variable.

This option does not support control structures such as loops or if-else statements. You can however use the ternary operator.

This option provides faster performance than Origin C.

-------------------- Example1: --------------------

temp = 10;
y1 = A + exp( (x1 - xc) / temp^2 );
y2 = A + temp / (x2 - xc)^2;

-------------------- Example2: --------------------

B = A / (0.5 * (sig1+sig2) * sqrt(2*pi));
sig = ( x<xc ? sig1:sig2 );
y = y0 + B * exp(-0.5 * ((x-xc)/sig)^2);


Thanks, Snow



Dear SnowLi:
Thanks for your immediate help! It works now!
By the way, I generated too many user-defined functions, how could I delete those functions?

meilongwei
snowli Posted - 04/16/2015 : 12:37:28 PM
Hello,

In Fitting Function Builder, you can choose Function Type to be Equation. Then you can split the functions into multiple lines.

But remember to put the final y=..... at the end instead of at the beginning.



The hint on left panel says

---------------------------------------------------------
Function Type
---------------------------------------------------------
Select this option if you need multiple lines or you have more than one dependent variable.

This option does not support control structures such as loops or if-else statements. You can however use the ternary operator.

This option provides faster performance than Origin C.

-------------------- Example1: --------------------

temp = 10;
y1 = A + exp( (x1 - xc) / temp^2 );
y2 = A + temp / (x2 - xc)^2;

-------------------- Example2: --------------------

B = A / (0.5 * (sig1+sig2) * sqrt(2*pi));
sig = ( x<xc ? sig1:sig2 );
y = y0 + B * exp(-0.5 * ((x-xc)/sig)^2);


Thanks, Snow
Meilongwei Posted - 04/16/2015 : 12:13:32 PM
quote:
Originally posted by jasonzhao

Hello,


You can refer to this tutorial for more information

http://www.originlab.com/doc/Tutorials/UserDef-FitFunc

The Derived Parameters is used in fitting.


Best regards!
Jason
OriginLab Technical Service



Hi Jason!
I clicked the link you attached, it just shows how to define general function for fitting. But my function is too long to write in oring C.It should be write as follows:
y=A*B*C+A*B+A*C+A/B+B*C+3A...(more complex than this)
A=a1*x+b1^x+x^c1+d1+exp(x^e1)
B=a2*x+b2^x+x^c2+d2+exp(x^e2)
C=a3*x+b3^x+x^c3+d3+exp(x^e3)

a1, b1,... a2, b2...are parameters need to be fitting. A, B, C are intermediate terms for shorten y expression. I mean during express y, A B C is necessary. So how to write it correctly?
Thank you !

meilongwei
jasonzhao Posted - 04/16/2015 : 05:21:24 AM
Hello,


You can refer to this tutorial for more information

http://www.originlab.com/doc/Tutorials/UserDef-FitFunc

The Derived Parameters is used in fitting.


Best regards!
Jason
OriginLab Technical Service

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