comp.lang.idl-pvwave archive - RDF feed
type: channel
description: Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado
items: Re: Is zero-degree fitting possible?

Re: Is zero-degree fitting possible?
type: item
description: In article <4kgkvb$kpj@lastactionhero.rs.itd.umich.edu>, Khai Trinh Pham <kpham@umich.edu> wrote: > > I am having problems doing a very simple zero-degree fit, i.e. fitting > only one parameter. I've tried POLY_FIT, CURVEFIT, and SVDFIT. > They each return the following error: > > IDL> F = POLY_FIT(Ycalculated, Yexperiment, 0) > % INVERT: Input must be a square matrix: A. > % Error occurred at: POLY_FIT 79 @IDL_DIR:[LIB]LIB.TLB(POLY_FIT) The internal invert function cannot invert a 1x1 array. Kind of silly. > I just want to find F such that (F * Ycalculated) gives the best fit > to (Yexperiment). > > Am I missing something really simple here? It looks to me that what you want is.... f=total(Yexperiment)/total(Ycalculated) Which is the solution to n --- > ( f*y_c -y_e) = 0 --- 0 or better yet, minimize the rms of (f*y_c-y_e) which would give you..... f=total(Yexperiment*Ycalculated)/total(Ycalculated*Ycalculat ed) Eric -- Eric Korpela | An object at rest can never be korpela@ssl.berkeley.edu | stopped. Click here for more info.
creator: korpela
date: 1996-04-10T07:00:00-00:00

Re: Is zero-degree fitting possible?
type: item
description: korpela@islay.ssl.berkeley.edu (Eric J. Korpela) writes: > In article <4kgkvb$kpj@lastactionhero.rs.itd.umich.edu>, > Khai Trinh Pham <kpham@umich.edu> wrote: >> >> I am having problems doing a very simple zero-degree fit, i.e. fitting >> only one parameter. I've tried POLY_FIT, CURVEFIT, and SVDFIT. >> They each return the following error: >> >> IDL> F = POLY_FIT(Ycalculated, Yexperiment, 0) >> % INVERT: Input must be a square matrix: A. >> % Error occurred at: POLY_FIT 79 @IDL_DIR:[LIB]LIB.TLB(POLY_FIT) > The internal invert function cannot invert a 1x1 array. Kind of silly. >> I just want to find F such that (F * Ycalculated) gives the best fit >> to (Yexperiment). >> >> Am I missing something really simple here? > It looks to me that what you want is.... > f=total(Yexperiment)/total(Ycalculated) > Which is the solution to > n > --- >> ( f*y_c -y_e) = 0 > --- > 0 > or better yet, minimize the rms of (f*y_c-y_e) which would > give you..... > f=total(Yexperiment*Ycalculated)/total(Ycalculated*Ycalculat ed) Or more generally, if you know the errors in each of the measured data points, then the best fit value for F would be f = total((Yexperiment*Ycalculated)/Yerror^2) / total(Ycalculated^2/Yerror^2) What you're really asking for is not a fit to a zero-degree polynomial, but a fit to a first-degree polynomial with the zero-order term forced equal to 0. Thus, even if you were able to pass the parameter 0 into POLY_FIT or any of the other routines, then it wouldn't have given you the right answer anyway. Bill Thompson
creator: thompson
date: 1996-04-11T07:00:00-00:00