Contents Previous Next Subchapters

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

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.

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

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