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

Home » Public Forums » archive » Re: polynomial fitting(second degree)
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Re: polynomial fitting(second degree) [message #70833] Mon, 10 May 2010 12:53 Go to next message
pgrigis is currently offline  pgrigis
Messages: 436
Registered: September 2007
Senior Member
One of the possible problem here is that your x-values are large
and close to each other. Therefore, it's not a good idea to have
a model that computes the square of a close set of large numbers,
as you could end up losing precision.

So doing the fitting in the variable x=(c-3933) instead is a much
better alternative. Does that work properly?

Ciao,
Paolo

On May 10, 2:36 pm, sid <gunvicsi...@gmail.com> wrote:
> Hi,
>     I am having wavelength in x axis from say c=(3933.2002 ,...
> 3933.4724) and intensity in y axis from say d
> =(0.085022407,.....0.081581624,.....,0.085993795).
> Now I did res=poly_fit(c,d,2)
> then, x=(-res(1)/(2*res(2) which should give the site of minimum
> value, but instead im getting some very weird answer as 4410.8199. I
> calculated y = res(0) + res(1)*x + res(2)*x^2 which should give the
> minimum value but it is also obviously weird.
> But the same procedure if I proceed with c=dindgen(78)(that is the
> number of wavelength values initially in c).
> Then if I do res=poly_fit(c,d,2)
> then i did x=(-res(1)/(2*res(2) and y = res(0) + res(1)*x +
> res(2)*x^2, in this way im getting resonable x and y value.
>
> Why it happens and please help me to get the correct solution, even if
> i do the same with the wavelength values.
> regards
> sid
Re: polynomial fitting(second degree) [message #70911 is a reply to message #70833] Wed, 12 May 2010 01:52 Go to previous message
sid is currently offline  sid
Messages: 50
Registered: January 1995
Member
On May 11, 12:53 am, Paolo <pgri...@gmail.com> wrote:
> One of the possible problem here is that your x-values are large
> and close to each other. Therefore, it's not a good idea to have
> a model that computes the square of a close set of large numbers,
> as you could end up losing precision.
>
> So doing the fitting in the variable x=(c-3933) instead is a much
> better alternative. Does that work properly?
>
> Ciao,
> Paolo
>
> On May 10, 2:36 pm, sid <gunvicsi...@gmail.com> wrote:
>
>> Hi,
>>     I am having wavelength in x axis from say c=(3933.2002 ,...
>> 3933.4724) and intensity in y axis from say d
>> =(0.085022407,.....0.081581624,.....,0.085993795).
>> Now I did res=poly_fit(c,d,2)
>> then, x=(-res(1)/(2*res(2) which should give the site of minimum
>> value, but instead im getting some very weird answer as 4410.8199. I
>> calculated y = res(0) + res(1)*x + res(2)*x^2 which should give the
>> minimum value but it is also obviously weird.
>> But the same procedure if I proceed with c=dindgen(78)(that is the
>> number of wavelength values initially in c).
>> Then if I do res=poly_fit(c,d,2)
>> then i did x=(-res(1)/(2*res(2) and y = res(0) + res(1)*x +
>> res(2)*x^2, in this way im getting resonable x and y value.
>
>> Why it happens and please help me to get the correct solution, even if
>> i do the same with the wavelength values.
>> regards
>> sid
>
>

Thank you very much, its working properly
regards
sid
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: SST data
Next Topic: LV Handbags ((http://www.jialiuonline.com

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

Current Time: Wed Oct 08 17:25:58 PDT 2025

Total time taken to generate the page: 0.00339 seconds