How to Create Equally Spaced Row Vectors in MATLAB
Method
linspace(a,b,n)
: Returns a row vector of divided into equal intervals.
If the number of elements is not specified, it returns a vector. It is used when the number of intervals is important, not the length of the intervals.
a: m :b
: Returns a row vector of divided by equal intervals of .
If the interval is not specified, the interval is set to . It is used when the length of the interval is important, not the number of intervals. There may not be a natural number that satisfies . In this case, the endpoint is not , but the largest number satisfying .
x1=linspace(1,10,10)
x2=linspace(1,10)
x3=linspace(5,55,2^5)
y1=1:3
y2=1:1/13:2
y3=3:1/7:7