Mercurial > hg > octave-nkf
diff scripts/polynomial/polyaffine.m @ 14104:614505385171 stable
doc: Overhaul docstrings for polynomial functions.
* mkpp.m, mpoles.m, pchip.m, poly.m, polyaffine.m, polyder.m, polyfit.m,
polygcd.m, polyint.m, polyout.m, polyreduce.m, polyval.m, polyvalm.m, ppder.m,
ppval.m, residue.m, roots.m, spline.m, unmkpp.m: Improve docstrings.
author | Rik <octave@nomad.inbox5.com> |
---|---|
date | Fri, 23 Dec 2011 20:09:27 -0800 |
parents | d5bd2766c640 |
children | 72c96de7a403 |
line wrap: on
line diff
--- a/scripts/polynomial/polyaffine.m +++ b/scripts/polynomial/polyaffine.m @@ -27,7 +27,7 @@ ## g(x) = f((x-@var{mu}(1))/@var{mu}(2)). ## @end example ## -## @seealso{polyval} +## @seealso{polyval, polyfit} ## @end deftypefn @@ -70,25 +70,19 @@ endfunction +%!demo +%! f = [1/5 4/5 -7/5 -2]; +%! g = polyaffine (f, [1, 1.2]); +%! x = linspace (-4, 4, 100); +%! plot(x, polyval (f, x), x, polyval (g, x)); +%! legend ("original", "affine"); +%! axis ([-4 4 -3 5]); +%! grid ("on"); + %!test %! f = [1/5 4/5 -7/5 -2]; -%! %! mu = [1, 1.2]; -%! %! g = polyaffine (f, mu); -%! %! x = linspace (-4, 4, 100); -%! -%! assert (polyval(f, x, [], mu), polyval (g, x), 1e-10); +%! assert (polyval (f, x, [], mu), polyval (g, x), 1e-10); -%!demo -%! f = [1/5 4/5 -7/5 -2]; -%! -%! g = polyaffine (f, [1, 1.2]); -%! -%! x = linspace (-4, 4, 100); -%! -%! plot(x, polyval (f, x), x, polyval (g, x)); -%! -%! axis ([-4 4 -3 5]); -%! grid ("on");