comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: Is zero-degree fitting possible?
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: Is zero-degree fitting possible? [message #6019] Thu, 11 April 1996 00:00 Go to previous message
thompson is currently offline  thompson
Messages: 584
Registered: August 1991
Senior Member
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
[Message index]
 
Read Message
Read Message
Previous Topic: character thickness of contour labelling
Next Topic: IDL procedures to get theromdynamic parameters from Soundings

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Fri Oct 10 12:09:24 PDT 2025

Total time taken to generate the page: 0.16434 seconds