Y linspace a b y linspace a b n description.
Matlab linspace.
The linspace function generates linearly spaced vectors.
The principal difference is that with the colon operator you define the interval between successive elements and let the length of the resulting vector vary and in linspace you define the length of the vector and the function calculates the interval to fit the length.
Matlab function reference.
It is similar to the colon operator but gives direct control over the number of points.
Y linspace x1 x2 n generates 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.
The function is the logarithmic equivalent of linspace and the operator.
There are two principal ways to create vectors in matlab.
Linspace function in matlab.
In this article we will understand a very useful function of matlab called linspace.
This function will generate a vector of values linearly spaced between two endpoints.
Generate linearly spaced vectors.
One is the colon operator and the other is the linspace function.
Using linspace 1 n n 1 360 is incorrect if the spacing between the points is meant to be 1 360.
See my answer below and the cyclist s comment above richard on 19 jan 2012.