How to find whether an array is logarithmically spaced
4 views (last 30 days)
Show older comments
Turaç Aydogan
on 26 Nov 2021
Commented: Mathieu NOE
on 26 Nov 2021
I have linearly, logarithmically and randomly spaced arrays. I need to tell them apart, but I am having trouble to determine whether an array is logarithmically spaced. Help is most appreciated!
2 Comments
Bjorn Gustavsson
on 26 Nov 2021
What have you tried, have you looked at how the spacing varies with the magnitude of the elements?
Accepted Answer
Mathieu NOE
on 26 Nov 2021
well
if you have a criteria that works for lin spaced arrays (like checking that std(diff(y)) is always below a very low threshold)
you can easily covert a log speced array to a lin spaced array by taking the log of it
demo :
y_log = logspace(1,3,100);
% nb : y = 10 .^ linspace(d1, d2, n);
y_lin = log10(y_log); % conversion from log to lin spacing
check = std(diff(y_lin))
check = 2.1980e-16
7 Comments
More Answers (0)
See Also
Categories
Find more on Regression 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!