The logspace
function in MATLAB is used to create a logarithmically spaced vector of values. The function takes the start and end points of the range, and the number of points desired within that range, and returns a vector with logarithmically spaced values.
Here is the syntax for the logspace
function in MATLAB:
main.m22 chars2 lines
Where:
a
is the 10
raised to the power of a
is the starting point of the rangeb
is the 10
raised to the power of b
is the ending point of the rangen
is the number of logarithmically spaced points desired within the rangeThe returned vector y
will have n
elements, logarithmically spaced between 10^a
and 10^b
.
Here is an example usage of the logspace
function:
main.m23 chars2 lines
In this example, x
will be a vector with 5 logarithmically spaced values between 10^0
and 10^2
. The resulting vector would be [1.0000, 3.1623, 10.0000, 31.6228, 100.0000]
.
Hope this helps!
gistlibby LogSnag