Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Polynomial is badly conditioned

888 views
Skip to first unread message

Saga

unread,
Mar 4, 2010, 9:12:05 AM3/4/10
to
Guys trying to create a polynomial formula but I go above order 5 i get this error msg "Warning: Polynomial is badly conditioned. Add points with distinct X
values, reduce the degree of the polynomial, or try centering
and scaling as described in HELP POLYFIT."

I've looked at help, but there is no information there.

Thanks

Steven Lord

unread,
Mar 4, 2010, 9:36:12 AM3/4/10
to

"Saga " <a5stargam...@googlemail.com> wrote in message
news:hmof3l$851$1...@fred.mathworks.com...

Reread this section from the help:

[P,S,MU] = POLYFIT(X,Y,N) finds the coefficients of a polynomial in
XHAT = (X-MU(1))/MU(2) where MU(1) = MEAN(X) and MU(2) = STD(X). This
centering and scaling transformation improves the numerical properties
of both the polynomial and the fitting algorithm.

--
Steve Lord
sl...@mathworks.com
comp.soft-sys.matlab (CSSM) FAQ: http://matlabwiki.mathworks.com/MATLAB_FAQ


Saga

unread,
Mar 4, 2010, 9:48:03 AM3/4/10
to
"Steven Lord" <sl...@mathworks.com> wrote in message <hmoggi$as7$1...@fred.mathworks.com>...

OK I understand it, but have no idea how to apply the method?

Thanks

Steven Lord

unread,
Mar 4, 2010, 10:15:10 AM3/4/10
to

"Saga " <a5stargam...@googlemail.com> wrote in message
news:hmoh72$qvk$1...@fred.mathworks.com...

Call the function with three outputs.

Saga

unread,
Mar 4, 2010, 5:24:22 PM3/4/10
to
"Steven Lord" <sl...@mathworks.com> wrote in message <hmoipk$av0$1...@fred.mathworks.com>...

Three outputs???

I only have (x,y,n)

The higher order I go it display the error.
Do you mean like this?

[P,S,MU] = POLYFIT(X,Y,N)

If yes what values are P,S and MU?

Thanks

pipa

unread,
Mar 4, 2010, 6:42:23 PM3/4/10
to

> Three outputs???
>
> I only have (x,y,n)
>
> The higher order I go it display the error.
> Do you mean like this?
>
> [P,S,MU] = POLYFIT(X,Y,N)
>
> If yes what values are P,S and MU?

P, S and MU are the three outputs which u will get after you use the polyfit function.

Saga

unread,
Mar 5, 2010, 6:03:02 AM3/5/10
to
"pipa " <balwind...@gmail.com> wrote in message <hmpggv$oqg$1...@fred.mathworks.com>...

Thanks but how would I use these values?

Steven Lord

unread,
Mar 5, 2010, 9:38:47 AM3/5/10
to

"Saga " <a5stargam...@googlemail.com> wrote in message
news:hmqod6$b5v$1...@fred.mathworks.com...

That depends on what you want to do with the polynomial after performing the
fitting -- me, I'd probably use then in a call to POLYVAL.

Saga

unread,
Mar 7, 2010, 4:05:24 AM3/7/10
to
"Steven Lord" <sl...@mathworks.com> wrote in message <hmr51c$rqm$1...@fred.mathworks.com>...

When I don't use P, S and MU I write a = polyfit(x,y,6)

then to calculate the polynomial I write polyval(a,x)

Where would I insert P,S and MU?

Thanks

Steven Lord

unread,
Mar 7, 2010, 11:15:49 PM3/7/10
to

"Saga " <a5stargam...@googlemail.com> wrote in message
news:hmvq8k$9i0$1...@fred.mathworks.com...

> "Steven Lord" <sl...@mathworks.com> wrote in message
> <hmr51c$rqm$1...@fred.mathworks.com>...

*snip*

> When I don't use P, S and MU I write a = polyfit(x,y,6)
>
> then to calculate the polynomial I write polyval(a,x)
>
> Where would I insert P,S and MU?

Read the help for POLYVAL -- it describes specifically how you use P, S, and
MU in a call to POLYVAL.

chiara dec

unread,
Jun 27, 2017, 7:58:08 AM6/27/17
to
>
> Where would I insert P,S and MU?
>
> Thanks


You can find an example of the implementation at the end of this page:
https://ch.mathworks.com/help/matlab/ref/polyfit.html

hope it helps!
0 new messages