[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
## Re: forcing polyfit through the origin

**From**: |
Paul Kienzle |

**Subject**: |
Re: forcing polyfit through the origin |

**Date**: |
Wed, 20 Mar 2002 13:11:08 -0500 |

You can modify the code for polyfit so that it does not
include the x^0 term. Do this using:
X = (x * ones (1, n)) .^ (ones (l, 1) * (1 : n));
instead of
X = (x * ones (1, n+1)) .^ (ones (l, 1) * (0 : n));
You will need to paste the zero term in when you are done:
p = flipud ([ 0; p]);
Paul Kienzle
address@hidden
On Wed, Mar 20, 2002 at 11:43:18AM -0600, Martijn Brouwer wrote:
>* *
>* Hi,*
>* Is there a way to force polyfit to make the first coefficient zero so*
>* the polynomial goes through the origin?*
>* *
>* Thanks,*
>* *
>* Martijn Brouwer*
>* *
>* *
>* *
>* -------------------------------------------------------------*
>* Octave is freely available under the terms of the GNU GPL.*
>* *
>* Octave's home on the web: http://www.octave.org*
>* How to fund new projects: http://www.octave.org/funding.html*
>* Subscription information: http://www.octave.org/archive.html*
>* -------------------------------------------------------------*
>* *
-------------------------------------------------------------
Octave is freely available under the terms of the GNU GPL.
Octave's home on the web: http://www.octave.org
How to fund new projects: http://www.octave.org/funding.html
Subscription information: http://www.octave.org/archive.html
-------------------------------------------------------------