non negative least squares fitting in igor
lingxiaoabc
I have 3 set of measured values Y (wave0,wave1,wave2), the x value for these three sets are the same. Now I want to use two sets to fitting the third one using least squares fitting. The fitting function is very simple, which is " fit_wave_3 = A*wave0+B*wave1", A and B is the corresponding coefficient. How do I conduct that in igor?
Thank you very much.
WAVE pw, yw, xw
WAVE wave0, wave1
yw = pw[0]*wave0(xw) + pw[1]*wave1(xw)
end
Note that the assignment at the end uses round parens "()" to index wave0 and wave1. If the X scaling is set correctly on wave0 and wave1, and the values are evenly spaced in X, then if your data to fit doesn't exactly match the X ranges of wave0 and wave1, Igor will do linear interpolation to get intermediate values.
John Weeks
WaveMetrics, Inc.
support@wavemetrics.com
December 11, 2014 at 09:32 am - Permalink
Dear johnweeks,
there is no variable in that function.
December 12, 2014 at 04:44 am - Permalink
The wave pw contains the fitting coefficients, A and B in your case.
Perhaps you might explain whether you have gone through a basic fitting tutorial, for example for a simple linear regression fit? In particular, do you understand the use of coefficient waves to carry the fitting parameters?
Or perhaps you are wanting something else in your fitting function.
--
J. J. Weimer
Chemistry / Chemical & Materials Engineering, UAHuntsville
December 12, 2014 at 10:10 am - Permalink