home *** CD-ROM | disk | FTP | other *** search
Text File | 1994-02-21 | 615 b | 22 lines | [TEXT/RLAB] |
- //-------------------------------------------------------------------//
- //
- // Syntax: linspace ( s1 , s2 )
- // linspace ( s1 , s2 , n )
-
- // Description:
-
- // Linspace generates a linearly spaced vector. linspace(s1, s2)
- // generates a vector of 100 equally spaced points between s1 and
- // s2. linspace(s1, s2, n) generates n equally spaced points between
- // s1 and s2.
-
- //-------------------------------------------------------------------//
-
-
- linspace = function ( s1 , s2, n )
- {
- if (!exist (n)) { n = 100; }
- if (n < 2) { error ("linspace: N must be >= 2"); }
- return [s1+(0:n-2)*(s2-s1)/(n-1), s2];
- };
-