T O P I C R E V I E W |
nesrin9002 |
Posted - 04/15/2014 : 9:51:14 PM Hi, Can someone help me with this; I am trying to write user defined function to fit my plot.
The equation I have to fit is z=Sum{z_n * Sin(n*x)} summation is over n, from lets say 0 to N. x(angles) is the values on the x axis in my plot.
Thanks, Nesrin.
|
4 L A T E S T R E P L I E S (Newest First) |
MaggotsBrain |
Posted - 05/25/2014 : 10:14:43 PM maybe this can help you: http://www.originlab.de/www/helponline/Origin/en/mergedProjects/Tutorial/Tutorial/User_Defined_Fitting_Function_using_OC.html |
long nguyen |
Posted - 05/23/2014 : 9:23:04 PM it difficult to understand .
|
greg |
Posted - 05/01/2014 : 09:07:17 AM I am not sure how your second post relates to the first. In the second you declared two arrays of double (c & d) which you did not initialize (so they are all zero). Even if you fixed that, your use of each array ( c[2*i+1] and d[2*i] ) over the range i = 1 to 10 would produce indices which were out of bounds of the arrays.
|
nesrin9002 |
Posted - 04/16/2014 : 1:22:44 PM So far I have this:
void _nlsfsum( // Fit Parameter(s): double y0, // Independent Variable(s): double x, // Dependent Variable(s): double& y) { // Beginning of editable part double c[11]; double d[11]; for(int i=1; i<=10; i++) { y=y0+c[2*i+1]* sin((2*i+1)*x) + d[2*i]* cos(2*i*x); }
It compiles but doesn't work when I fit it to the data. |