Origin Ver.8.0 and Service Release 4 Operating System: WINDOWS XP
Hi,
i would like to fit the following funktion: y=N+2*sum [(N-k)*cos(k*x*d)*exp(-(d/2pi)^2*x^2*nc*g+ln(pi*k)))*exp(-k^2*x^2*dd^2/2)] and the sum is from k=1 to k=N
Therefore wrote a little scrpit in the Fitting Function Organizer using a Y-Script: ***************************************** // Independent Variables x
// Dependnet Variables y
// Parameters nc, dd
double d=64.5; double g=0.5772; double vec=0; int N=100; int k=1;
for(k=1;k<=N;k+1){ vec +=(N-k)*cos(k*x*d)*exp(-(d/2/pi)^2*x^2*nc*(g+ln(pi*k)))*exp(-k^2*x^2*dd^2/2); } y=N+2*vec; ***************************************************
Now is the calculation very slow, exspecially for large N.
Is it possible to write this in a "Origin C" script to make it faster?
Regards, Martin |