Contents Previous Next Subchapters

Evenly Spaced Grid With a Specified Number of Points
Syntax linspace(lowerupper)
linspace(loweruppernpoint)
See Also sequence , logspace

Description
Returns a double-precision row vector of int(npoint) equally spaced points starting at lower and ending at upper. The arguments lower, upper, and npoint, are all integer, real, or double-precision scalars. If the argument npoint is not present, the value 100 is used in its place.

Example
If you enter
     ginit
     x = linspace(-pi, +pi)
     plot(x, sin(x))
O-Matrix will draw the following plot

Reference
Note that the return value of linspace is a row vector. So, for example, to make the plot above using gplot you would enter
     ginit
     x = linspace(-pi, +pi)'
     gplot(x, sin(x))
(Note the ' in this example that is not in the example above.)