logarithmic binning data in matlab

7 views (last 30 days)
C.G.
C.G. on 11 Mar 2022
Edited: John D'Errico on 6 Apr 2022
I have a dataset, and I have been told to bin the data using logarithmic binning.
How would I go about logarithmic binning this dataset?

Answers (1)

John D'Errico
John D'Errico on 6 Apr 2022
Edited: John D'Errico on 6 Apr 2022
It is not clear what you mean by logarithmic binning.
Looking at your data however, tells me that you were told to do something that makes no sense at all.
min(Q)
ans =
-4.77253376114796
max(Q)
ans =
47.6051494981383
mode(Q)
ans =
0
sum(Q == 0)
ans =
22891
numel(Q)
ans =
57158
So your data goes from negative to positive values, but there is a HUGE spike at EXACTLY 0. Literally half of your data is EXACTLY zero. Not just close. But EXACTLY so.
histogram(Q,1000)
Sorry. In no circumstances would any sort of traditional logarithmic binning like that make sense. And that HUGE spike at 0 makes things almost impossible to work with.
Could you choose bins that grow in size, as you move away from zero, in BOTH directions? Well, yes.
I would recommend you return to whoever told you to do this, and show them your actual data. Then ask them SPECIFICALLY what they think you should do. Don't just let them tell you to do something by some vague name. Have them tell you explicitly what they think is appropriate here.

Community Treasure Hunt

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

Start Hunting!