Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

linspace

MATLAB linspace function


Description

Generate linearly spaced vectors.

Usage

linspace(a, b, n=100)

Arguments

a

numeric scalar specifying starting point

b

numeric scalar specifying ending point

n

numeric scalar specifying number of points to be generated

Details

Similar to colon operator but gives direct control over the number of points. Note also that although MATLAB doesn't specifically document this, the number of points generated is actually floor(n).

Value

Returns vector containing containing n points linearly spaced between a and b inclusive. If \code{n} < 2, the result will be the ending point b.

Author(s)

See Also

Examples

linspace(1, 10, 4)

matlab

MATLAB emulation package

v1.0.2
Artistic-2.0
Authors
P. Roebuck
Initial release
2014-06-19

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.