comparison 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
comparison
equal deleted inserted replaced
3417:cb56e4bd79ca 3418:ca92c9d3f882
30 ## @end iftex 30 ## @end iftex
31 ## @ifinfo 31 ## @ifinfo
32 ## @code{sumsq (p(x(i)) - y(i))}, 32 ## @code{sumsq (p(x(i)) - y(i))},
33 ## @end ifinfo 33 ## @end ifinfo
34 ## to best fit the data in the least squares sense. 34 ## to best fit the data in the least squares sense.
35 ##
36 ## The polynomial coefficients are returned in a row vector if @var{x}
37 ## and @var{y} are both row vectors; otherwise, they are returned in a
38 ## column vector.
35 ## 39 ##
36 ## If two output arguments are requested, the second contains the values of 40 ## If two output arguments are requested, the second contains the values of
37 ## the polynomial for each value of @var{x}. 41 ## the polynomial for each value of @var{x}.
38 ## @end deftypefn 42 ## @end deftypefn
39 43
74 endif 78 endif
75 endif 79 endif
76 80
77 p = flipud (p); 81 p = flipud (p);
78 82
79 if (! prefer_column_vectors) 83 if (y_is_row_vector && rows (x) == 1)
80 p = p.'; 84 p = p';
81 endif 85 endif
82 86
83 endfunction 87 endfunction