Mercurial > octave
view examples/code/@polynomial/plot.m @ 21067:9b3149cd486b
Fix incorrect example code for @polynomial/plot.m (bug #46892).
* examples/code/@polynomial/plot.m: Use polyval method to evaluate
polynomial rather than operator overloading of indexing which won't work in
class method.
author | Rik <rik@octave.org> |
---|---|
date | Thu, 14 Jan 2016 08:15:40 -0800 |
parents | 73ab962bc52d |
children |
line wrap: on
line source
function h = plot (p, varargin) n = 128; rmax = max (abs (roots (p.poly))); x = [0 : (n - 1)] / (n - 1) * 2.2 * rmax - 1.1 * rmax; if (nargout > 0) h = plot (x, polyval (p, x), varargin{:}); else plot (x, polyval (p, x), varargin{:}); endif endfunction