selecting waves in a function doing a linear combination fitting
Wed, 01/23/2019 - 11:22 am
I am using a linear combination of multiple contributions (2 to 4) to fit data. They all have the same x scaling. This is an example for a fit using 3 waves:
Wave par, y, x
Wave C1, C2, C3
MultiThread y = par + par*C1(x) + par*C2(x) + par*C3(x)
I have two other functions that use 2 or 4 C waves, i.e., LinearCombination2C and LinearCombination4C.
I am then calling these functions in another function that includes a prompt where user can select input data, range, constraints, and C contributions that will be used for the fit. Based on the C waves selected (or not) in the prompt, the function then runs the corresponding "LinearCombinationxC" function shown above.
FuncFit/X=1/H="1000" LinearCombination3C tempcoeff tempinput[lrange,hrange] /D=tempoutput /R=tempresidual /C=T_constraints
What I want to do is be able to tell Igor which contributions to use to run the linear combination, rather than having to create waves called C1 C2 etc. and I can't figure it out. As it is right now, the first contribution I use to run the fit must be named C1, the second C2, etc. So if I want to use C2 and C3 to run the fit, I have to rename those to C1 and C2... How can I define which contribution/coefficient waves to use in the fit?