# Re: FW: lspoly didn't wok when the number of data points equal to the number of coefficients

From: Richard Liang <richardljy_at_nyahnyahspammersnyahnyah>
Date: Sun Dec 29 2013 - 09:53:02 MST

Thanks, Dennis
The document said "It is necessary that the number of data points) be greater than or equal to n(the number of coefficients)."
As I understand , for example, if I have 3 points, the max number of coefficients can be 3.
Mathematically, if I have 3 points, I can make an secend order polynomial to fit these points , in which I should have 3 coefficients.

Best

> Date: Sat, 28 Dec 2013 08:26:49 -0700
> From: shea@ucar.edu
> To: richardljy@hotmail.co.uk; ncl-talk@ucar.edu
> Subject: Re: FW: lspoly didn't wok when the number of data points equal to the number of coefficients
>
> As noted in the documentation:
>
> n
>
> The number of coefficients desired (i.e., n-1 will be the degree of the
> polynomial). Due to the method used, n should be less than or equal to
> five.
>
> ===
>
> In your case with 3 points, the max number of coefficients would be 2
>
>
> On 12/28/13, 5:01 AM, Richard Liang wrote:
> >
> >
> > From: richardljy@hotmail.co.uk
> > To: ncl-talk@ucar.edu
> > Subject: lspoly didn't wok when the number of data points equal to the number of coefficients
> > Date: Sat, 21 Dec 2013 15:45:08 -0500
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> > lspoly didn't wok when the number of data points equal to the number of coefficientsI did the test
> > x = (/-4.5, -3.2, -1.4/)y = (/ 0.7, 2.3, 3.8/)n = 3 c = lspoly(x,y, 1, n) print(c)c will be(0) 1e+20(1) 1e+20(2) 1e+20
> >
> >
> > But if n=2 c will be(0) 5.268707(1) 0.9896836
> > I also did the test in the 4 element array, when n=4, it didn't work. only when n is less than the number of data points
> > Any body help me? thanks
> >
> >
> >
> >
> > _______________________________________________
> > ncl-talk mailing list
> > List instructions, subscriber options, unsubscribe:
> > http://mailman.ucar.edu/mailman/listinfo/ncl-talk
> >

_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Sun Dec 29 09:53:18 2013

This archive was generated by hypermail 2.1.8 : Mon Jan 06 2014 - 13:02:22 MST