In this article we will understand a very useful function of matlab called linspace.
Mat lab linspace.
See my answer below and the cyclist s comment above richard on 19 jan 2012.
Matlab function reference.
Y logspace a b generates a row vector y of 50 logarithmically spaced points between decades 10 a and 10 b the logspace function is especially useful for creating frequency vectors.
There are two principal ways to create vectors in matlab.
One is the colon operator and the other is the linspace function.
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.
Y linspace x1 x2 n generates n points the spacing between the points is x2 x1 n 1.
The function is the logarithmic equivalent of linspace and the operator.
Linspace is similar to the colon operator but gives direct control over the number of points and always includes the endpoints.
The linspace function generates linearly spaced vectors.
Generate linearly spaced vectors.
Y linspace a b y linspace a b n description.
Lin in the name linspace refers to generating linearly spaced values as opposed to the sibling function logspace which generates logarithmically spaced.
It will need two inputs for the endpoints and an optional input to specify the number of points to include in the two endpoints.
It is similar to the colon operator but gives direct control over the number of points.
Using linspace 1 n n 1 360 is incorrect if the spacing between the points is meant to be 1 360.