Re: Is zero-degree fitting possible? [message #6019] |
Thu, 11 April 1996 00:00 |
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
|
|
|
Re: Is zero-degree fitting possible? [message #6024 is a reply to message #6019] |
Wed, 10 April 1996 00:00  |
korpela
Messages: 59 Registered: September 1993
|
Member |
|
|
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.
<a href=" http://www.cs.indiana.edu/finger/mofo.ssl.berkeley.edu/korpe la/w">
Click here for more info.</a>
|
|
|