Mercurial > hg > octave-max
changeset 415:0ce34c2fc3d5
[project @ 1994-05-16 18:30:52 by jwe]
author | jwe |
---|---|
date | Mon, 16 May 1994 18:31:31 +0000 |
parents | 9a17c682207e |
children | 6f08c8b8f62f |
files | scripts/general/linspace.m scripts/general/logspace.m |
diffstat | 2 files changed, 4 insertions(+), 10 deletions(-) [+] |
line wrap: on
line diff
--- a/scripts/general/linspace.m +++ b/scripts/general/linspace.m @@ -1,4 +1,4 @@ -# Copyright (C) 1993 John W. Eaton +# Copyright (C) 1993, 1994 John W. Eaton # # This file is part of Octave. # @@ -47,10 +47,7 @@ if (length (x1) == 1 && length (x2) == 1) delta = (x2 - x1) / (npoints - 1); - retval = zeros (1, npoints); - for i = 0:npoints-1 - retval (i+1) = x1 + i * delta; - endfor + retval = x1:delta:x2; else error ("linspace: arguments must be scalars"); endif
--- a/scripts/general/logspace.m +++ b/scripts/general/logspace.m @@ -1,4 +1,4 @@ -# Copyright (C) 1993 John W. Eaton +# Copyright (C) 1993, 1994 John W. Eaton # # This file is part of Octave. # @@ -57,10 +57,7 @@ if (x2 == pi) x2_tmp = log10 (pi); endif - retval = linspace (x1, x2_tmp, npoints); - for i = 1:npoints - retval(i) = 10 ^ retval(i); - endfor + retval = 10 .^ (linspace (x1, x2_tmp, npoints)); else error ("logspace: arguments must be scalars"); endif