Re: polynomial fitting(second degree) [message #70833] |
Mon, 10 May 2010 12:53  |
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
|
|
|