
Custom Fit Function using Predefined waves

Hello,
So to preface my question, I have many spectra that are made up of mixtures of two different species with overlapping features. I have the spectra of each individual specie that I can sum together to recreate the mixture spectra if I apply the right mixture coefficients. Instead of doing this manually to find the mixture ratios, I wanted to write a fit function in Igor to fit each spectra and use the coefficients to find the ratio.
I tried to use the custom fit function to write my own fit, but I find I can't seem to use the spectra waves of the two species in the fit function without error.
Example: f() = a*Sp1+b*Sp2
a=coeff of Sp1
b=coeff of Sp2
Sp1 = reference wave of species 1
Sp2 = reference wave of species 2
How could I go about remedying this?
Thanks!
This should do it:
Note that this function assumes that sp1 and sp2 have the X scaling set (if this is not familiar, execute this command in Igor: DisplayHelpTopic "The Waveform Model of Data").
It handles the case where the fit X range is outside the range of sp1 and sp2 by returning the value at one end or the other as appropriate. It *does* assume that sp1 and sp2 have the SAME X range.
It looks up interpolated values from sp1 and sp2 using X indexing.
November 8, 2018 at 09:20 am - Permalink
Oh, and it assumes that the waves with your standard spectra are named literally "sp1" and "sp2".
November 8, 2018 at 09:21 am - Permalink