Approximation of F(x)= [a*G(x) + b*H(x)] / [a+b]

Hi,

I want to approximate one curve I measured F(x) with two other curves G(x) and H(x).
All three are measured curves therefore they are not flexibel. All curve have the same amount of datapoints and the corresponding x-values are the same for each of the three.
The formula I want to use is:
F(x)= [a*G(x) + b*H(x)] / [a+b]
Igor should than take F, G,and H from already loaded curves (later on with a procedure loading the waves from files) and "search" for a and b values giving me the best possible match.
Can Igor do something like that?

Thank you
Yes, this is simply a multivariate regression of F on G and H. Create a fitting function like this:
Function Moritz(ab,ff,gg,hh) : FitFunc
    wave ab,ff,gg,hh
   
    ff=(ab[0]*gg+ab[1]*hh)/(ab[0]+ab[1])
End


Then you can fit like this (I am illustrating with made up data):
Function DoTheFit()
  make /o/n=(100,2) xx=gnoise(1) // 2 column wave containing the covariates (e.g. G and H).  
  make /o/n=100 yy=(3*xx[p][0]+5*xx[p][1])/(3+5) // 1 column wave containing the dependent variable (e.g. F).  
  make /o/n=2 coefs={1,1} // My initial guesses (a=1, b=1).  
  funcfit Moritz coefs yy /X=xx
  print coefs // The answers.  
End


Even better, since you have the normalization constraint in the denominator, there is really only one parameter, and you can instead write:
Function Moritz(ab,ff,gg,hh) : FitFunc
    wave ab,ff,gg,hh
   
    ff=(ab[0]*gg+(1-ab[0])*hh)
End


and do the same fit with a one-point coefs wave instead.

Rick