Mercurial > hg > octave-nkf
changeset 12482:3244c6e0af4a
polynomial/polyval.m: Compute offset/normalization only when needed.
author | Ben Abbott <bpabbott@mac.com> |
---|---|
date | Sat, 26 Feb 2011 16:21:02 -0500 |
parents | 97d103fcb6dd |
children | 7a5aacf65f81 |
files | scripts/ChangeLog scripts/polynomial/polyval.m |
diffstat | 2 files changed, 6 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/scripts/ChangeLog +++ b/scripts/ChangeLog @@ -1,3 +1,7 @@ +2011-02-26 Robert T. Short <octave@phaselockedsystems.com> + + * polynomial/polyval.m: Compute offset/normalization only when needed. + 2011-02-26 Robert T. Short <octave@phaselockedsystems.com> * polynomial/polyval.m: Minor simplification in polynomial evaluation.
--- a/scripts/polynomial/polyval.m +++ b/scripts/polynomial/polyval.m @@ -53,8 +53,8 @@ error ("polyval: first argument must be a vector"); endif - if (nargin < 4) - mu = [0, 1]; + if (nargin > 3) + x = (x - mu(1)) / mu(2); endif if (isempty (x)) @@ -68,7 +68,6 @@ endif n = length (p) - 1; - x = (x - mu(1)) / mu(2); y = p(1) * ones (size (x)); for i = 2:n+1 y = y .* x + p(i);