Compilation Error When Using the /CMAG Flag with the CurveFit Operation under nonzero ODR
saldfanos
Dear Igor Pro community,
I'm currently working on implementing a Sin fitting function, as illustrated in the code below. This function aims to fit data to a sine curve using the CurveFit operation in Igor Pro:
Function Sinfitting(S_wname, V_y0, V_A, V_frq, V_phy)
string S_wname
variable V_y0, V_A, V_frq, V_phy
wave W_current=$S_wname
wave W_coef=W_coef
K0 = V_y0; K1 = V_A; K2 = V_frq ;K3 = V_phy
Make/O/N=4 /free W_scaleWave={2.5, 2.5, 0.0349066, pi/2}
Make/O/T/N=4 T_Constraints = {"K0 > 0","K1 > 0","K3 >= 0","K3 < 2*pi"}
CurveFit /Q/N/ODR=2 /H="0010"/CMAG=W_scaleWave sin W_current[30,360] /D /C=T_Constraints
end
string S_wname
variable V_y0, V_A, V_frq, V_phy
wave W_current=$S_wname
wave W_coef=W_coef
K0 = V_y0; K1 = V_A; K2 = V_frq ;K3 = V_phy
Make/O/N=4 /free W_scaleWave={2.5, 2.5, 0.0349066, pi/2}
Make/O/T/N=4 T_Constraints = {"K0 > 0","K1 > 0","K3 >= 0","K3 < 2*pi"}
CurveFit /Q/N/ODR=2 /H="0010"/CMAG=W_scaleWave sin W_current[30,360] /D /C=T_Constraints
end
When I run the function, I get a compilation error. The error message is:
"unknown flag"
I'm unsure where I'm going wrong or if I'm misunderstanding how the CurveFit
operation works with constraints. Any help with this issue would be greatly appreciated.
Best regards,
I've resolved the issue. Here's the solution:
This seems to work without any problems.
October 6, 2023 at 09:36 pm - Permalink
It is confusing that there are two groups of flags for the CurveFit operation. To try to give a hint to this in the documentation, we gave the first set of flags the sub-topic title "Flags" and the second group "Flag Parameters". It would be nice if we could go back in time and fix this confusing syntax.
October 9, 2023 at 03:56 pm - Permalink
I now have a better understanding. Thank you very much.
December 10, 2023 at 01:29 am - Permalink