Mercurial > hg > octave-lojdl
changeset 1098:c0f319a1e51d
[project @ 1995-02-13 16:46:08 by jwe]
author | jwe |
---|---|
date | Mon, 13 Feb 1995 16:46:08 +0000 |
parents | 3243a4f59937 |
children | 8a5b0b2caf44 |
files | scripts/general/linspace.m |
diffstat | 1 files changed, 4 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/scripts/general/linspace.m +++ b/scripts/general/linspace.m @@ -45,9 +45,12 @@ error ("linspace: npoints must be greater than 2"); endif +# In some cases x1 + delta * (npoints - 1) will not be equal to x2, so +# we cheat and force the last value to be x2. + if (length (x1) == 1 && length (x2) == 1) delta = (x2 - x1) / (npoints - 1); - retval = x1:delta:x2; + retval = [x1+(0:npoints-2)*delta, x2]; else error ("linspace: arguments must be scalars"); endif