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
 Gaussian progression fitting with a summation

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
sreelakshmi Posted - 10/08/2017 : 10:19:15 PM
Origin Ver. and Service Release (Select Help-->About Origin):
Operating System:

Hi,
I need to build a function in origin to fit my data. It contains a summation and a factorial. Here the function,

y = Sum[ (a1^m/m!* exp(-(x-a2+(m*Eph))^2)/(2*a3^2)]

This equation is to fit my data with a progression of Gaussians. Here summation is over m (m is actually the number of Gaussians used for fitting) whose value is starting from 1. The fitting parameters are [m,a1,a2,a3] and Eph is a constant. I am not good in programming. So please help me!!
2   L A T E S T    R E P L I E S    (Newest First)
sreelakshmi Posted - 10/10/2017 : 6:42:38 PM
Hi,
I used the fitting function builder. There I defined the dependent and independent variables. Defined the parameters m,a1,a2,a3. Then I defined the function as follows,

void _nlsffrankk(
// Fit Parameter(s):
double m, double a1, double a2, double a3,
// Independent Variable(s):
double x,
// Dependent Variable(s):
double& y)
{
// Beginning of editable part

double Factm = 1.0;
const double Eph = 0.17;
{
double bb = 0;
for(int ii =1; ii<=m; ii++)
{
Factm *= ii;
bb = ( ( (6.606*10^-34) * (1240/x))^3) * 1.4 * (a1^m/ Factm) * exp (-( (x*a2+m*Eph)^2)/(2*a3^3)) + bb;
}
return bb;
}
// End of editable part

I tried the syntax for factorial you send me, but didn't work. So I used another cord as above. But the program is giving an error as 'Invalid return statement'. Here 'm' is also a parameter.
Shirley_GZ Posted - 10/09/2017 : 04:56:31 AM
Hi sreelakshmi,

We have a FAQ page to teach you how to define a summation function,
see
http://www.originlab.com/doc/Quick-Help/Summation-DoubleIntegral-Func

For the factorial m!, please try one of the functions

http://www.originlab.com/doc/LabTalk/ref/Fact-func or
http://www.originlab.com/doc/LabTalk/ref/Gamma-func

Please let me know if any problem.

Thanks,
Shirley
OriginLab


Originlab Technical Service Team

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