How to find whether an array is logarithmically spaced
4 次查看(过去 30 天)
显示 更早的评论
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 个评论
Bjorn Gustavsson
2021-11-26
What have you tried, have you looked at how the spacing varies with the magnitude of the elements?
采纳的回答
Mathieu NOE
2021-11-26
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
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Regression 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!