linspace
Generate linearly spaced vector
Syntax
y = linspace(x1,x2)
y = linspace(x1,x2,n)
Description
y = linspace(
generatesx1,x2
,n
)n
points. The spacing between the points is(x2-x1)/(n-1)
.
linspace
is similar to the colon operator, “:
”, but gives direct control over the number of points and always includes the endpoints. “lin
” in the name “linspace
” refers to generating linearly spaced values as opposed to the sibling functionlogspace
, which generates logarithmically spaced values.
Examples
Input Arguments
Extended Capabilities
Introduced before R2006a
Was this topic helpful?