Skip to content

logspace

Vector of logarithmically (base-10) spaced points.

y = logspace(a, b)
y = logspace(a, b, n)

Returns a row vector of n values logarithmically spaced between 10^a and 10^b (both inclusive). Default n is 100. Equivalent to 10 .^ linspace(a, b, n).

Useful for sampling parameter sweeps that span many orders of magnitude — frequencies, regularization strengths, etc.

logspace(0, 3, 4) % [1 10 100 1000]
logspace(-3, 3, 7) % [1e-3 1e-2 0.1 1 10 100 1e3]
  • linspace — Vector of equally spaced points between two endpoints.