Create logarithmically spaced vector with points spaced more closely at far end of vector

6 views (last 30 days)
Is it possible to use logspace (or some other approach) to create a logrithmically spaced vector where the points are more closely spaced at the far end of the vector? For example, for the vector x = logspace(1, 2, 100), I would like to have the points spaced more closely toward the 10^2 = 100 end of the vector. I can't be the first person to want to do this...Thanks in advance for anyone's help!

Accepted Answer

Akira Agata
Akira Agata on 18 Nov 2022
Like this?
% Normal log-spaced vector
x1 = logspace(1, 2, 10);
% Create inverse log space
delta = diff(x1);
delta = fliplr(delta);
% Inversely log-spaced vector
x2 = [10, 10+cumsum(delta)];
% Check!
plot(x1, 'o')
hold on
plot(x2, 'v')
legend({'x1', 'x2'}, 'Location', 'best')

Sign in to comment.

More Answers (0)


Find more on Creating and Concatenating Matrices in Help Center and File Exchange




Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!