Curve Fitting with macro
PASQUIER
I would like to fit a lot of data with a polynomial function by using an igor macro.
In the macro, I write
CurveFit/NTHR=0/TBOX=0 poly $namespectre /M=$namemask
$nameBLref=poly(W_coef,x)
In this case, an error message appears "ambigous wave point number" and $namespectre is selected.
I also try this syntax :
CurveFit/NTHR=0/TBOX=0 poly 3 $namespectre /M=$namemask
$nameBLref=poly(W_coef,x)
Now, 3 is selected, and the error message is "expected operator"
From a general point of view, I have a problem with this function. How can I define the polynomial terms in macro ?
Should I create an user-defined function ?
Thank you a lot for your valued assistance
Hélène
welcome to the forum. Your code is nicer to read if you use the igor tags.
I would say the igor error message wants to tell you that the string
namespectre
does not hold a valid wave.It is generally easier if you use wave references instead of
$
string magic.Something like
Display data
CurveFit/TBOX=115 poly 3, data/D
works here.
February 25, 2016 at 08:22 am - Permalink
Variable order
Wave junk
CurveFit/M=2/W=0 poly (order+1), junk/D
end
The "+1" is because the input is number of terms, not order of the polynomial.
But perhaps you should check out the Batch Curve Fit package (Analysis->Packages->Batch Curve Fit). It is moderately complicated; you will want to look at the demo: File->Example Experiments->Curve Fitting->Batch Curve Fit Demo.pxp.
John Weeks
WaveMetrics, Inc.
support@wavemetrics.com
February 25, 2016 at 10:17 am - Permalink
many thanks for your answers.
Now I fix the problem !
It is a judicious idea to define the order, John. Igor is the best, anyway !
Thanks a lot !
Hélène
February 26, 2016 at 04:39 am - Permalink