diff scripts/polynomial/polyfit.m @ 3418:ca92c9d3f882

[project @ 2000-01-12 03:07:47 by jwe]
author jwe
date Wed, 12 Jan 2000 03:07:52 +0000
parents a4cd1e9d9962
children f8dde1807dee
line wrap: on
line diff
--- a/scripts/polynomial/polyfit.m
+++ b/scripts/polynomial/polyfit.m
@@ -32,6 +32,10 @@
 ## @code{sumsq (p(x(i)) - y(i))},
 ## @end ifinfo
 ##  to best fit the data in the least squares sense.
+##
+## The polynomial coefficients are returned in a row vector if @var{x}
+## and @var{y} are both row vectors; otherwise, they are returned in a
+## column vector.
 ## 
 ## If two output arguments are requested, the second contains the values of
 ## the polynomial for each value of @var{x}.
@@ -76,8 +80,8 @@
 
   p = flipud (p);
 
-  if (! prefer_column_vectors)
-    p = p.';
+  if (y_is_row_vector && rows (x) == 1)
+    p = p';
   endif
 
 endfunction