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
 non-linear function builder and fit
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

mahajan

India
1 Posts

Posted - 05/09/2021 :  07:37:05 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Origin Ver. and Service Release (Select Help-->About Origin): OriginPro 2019b (64-bit)
9.6.5.169 (Academic)

Operating System:Windows 10

Hi

I want to make a user defined function for fitting some data. The function contains variables which are defined by other equations. See below..
y is the dependent variable and T is the independent variable.
J, a, g are fitting parameters.
I tried to use the function form as origin C but it did not compile (I am not sure how to define the intermediate variables N1, N2 etc.). If I used the function form as Equations then it seemed to work...it could calculate the value of y for a sample value of T. But in this case, I can not simulate the curve (that option seems grayed out).
Kindly let me know how to build the fitting function so that I can simulate the curve for various choice of parameters.

thanks

Avinash Mahajan
------------------
N1=0.63427990 - 2.06777217*a - 0.70972219*a^2 + 4.89720885*a^3 - 2.80783223*a^4
N2=0.18776962 - 2.84847225*a + 5.96899688*a^2 - 3.85145137*a^3 + 0.64055849*a^4
N3=0.033603617 - 0.757981757*a + 4.137970390*a^2 - 6.100241386*a^3 + 2.701116573*a^4
N4=0.0038611069 + 0.5750352896*a - 2.3359243110*a^2 + 2.934083364*a^3 - 1.1756629304*a^4
N5=0.00027331430 - 0.10724895512*a + 0.40345647304*a^2 - 0.48608843641*a^3 + 0.18972153852*a^4
N6=0 + 0.00578123759*a - 0.02313572892*a^2 + 0.02892774508*a^3 - 0.01157325374*a^4
N71=2.59870347e-7
N72= -2.39236193e-7
DeltaNotStar =(1-a)^(3/4)*(1+a)^(1/4) + 0.38658545*a*(1-a) - 0.20727806*a^2*(1-a)^2
ypower=4.69918784

D1=-0.11572010 - 1.31777217*a + 1.29027781*a^2 + 3.39720885*a^3 - 2.80783223*a^4
D2=0.08705969 - 1.44693321*a + 5.09401919*a^2 - 10.51861382*a^3 + 8.97655318*a^4+5.75312680*a^5 - 11.83647774*a^6 + 4.21174835 *a^7
D3= 0.00563137 + 0.65986015*a - 1.38069533*a^2 - 0.09849603*a^3 + 7.54214913*a^4-22.31810507*a^5 + 27.60773633*a^6 - 6.39966673*a^7 - 15.69691721*a^8 + 13.37035665*a^9 - 3.15881126*a^10
D4=0.0010408866 + 0.1008789796*a - 0.9188446197*a^2 + 1.6052570070*a^3 - 0.7511481272*a^4
D5=0.0000683286 + 20.1410232710*a + 0.6939435034*a^2 - 0.9608700949*a^3 + 0.4106951428*a^4
D6=0 + 0.0367159872*a - 0.1540749976*a^2 + 0.1982667100*a^3 - 0.0806430233*a^4
D7=0 - 0.00314381636*a + 0.01140642324*a^2 - 0.01338139741*a^3 + 0.00511879053*a^4
D81=1.25124679e-7
D82=-1.03824523e-7
zpower=3.55692695

DeltaFitStar = 1 - (1/2)*a - 2*a^2 + (3/2)*a^3

DEN = 1 + D1*(J/T) + D2*(J/T)^2 + D3*(J/T)^3 + D4*(J/T)^4 + D5*(J/T)^5 + D6*(J/T)^6 + D7*(J/T)^7 + (D81*a+D82*a^2)*(DeltaNotStar*(J/T))^zpower*(J/T)^8*exp((DeltaNotStar - DeltaFitStar)*(J/T))
NUM = 1 + N1*(J/T) + N2*(J/T)^2 + N3*(J/T)^3 + N4*(J/T)^4 + N5*(J/T)^5 + N6*(J/T)^6 + (N71*a+N72*a^2)*(DeltaNotStar*(J/T))^ypower*(J/T)^7


y=0.375*g^2*exp(-DeltaFitStar*(J/T))*(1/(4*T))*NUM/DEN
------------------

YimingChen

1592 Posts

Posted - 05/10/2021 :  09:09:09 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
You will need to follow OriginC language syntax:
1. For intermediate variable, you need to specify the variable type.
2. End each line with semicolon.

e.g.
double N1=0.63427990 - 2.06777217*a - 0.70972219*a^2 + 4.89720885*a^3 - 2.80783223*a^4;


James

Edited by - YimingChen on 05/10/2021 09:10:03 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