Problems with the Mode function
6 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
PAK
el 5 de En. de 2019
Comentada: PAK
el 5 de En. de 2019
Hi Everyone,
Happy New Year!
I'm having problems with the "mode" function in Matlab 2018a. I have a 1x1979253 single "x", where Matlab calculates the mode as 36.1455.
However, when I quick check to make sure that makes sense by putting my values into a histogram, it is very clear the mode should be in the 60s, which also is where I was expecting it to be.
Any ideas what could be causing this? I've attached the histogram for reference.![LFP_Frequencies.jpg](https://www.mathworks.com/matlabcentral/answers/uploaded_files/200198/LFP_Frequencies.jpeg)
![LFP_Frequencies.jpg](https://www.mathworks.com/matlabcentral/answers/uploaded_files/200198/LFP_Frequencies.jpeg)
Thanks!
PAK
y = mode(x,2);
histogram(x);
0 comentarios
Respuesta aceptada
Image Analyst
el 5 de En. de 2019
We're not sure how you plotted that. Are you sure that the x axis are the actual values of your data, and not just the bin numbers? Did you do
[counts, edges] = histcounts(data);
bar(counts);
or did you do
bar(edges(1:end-1), counts);
Are you sure that it's bin 60 that is the highest and bin 60 contains values from 32 to 35 or something?
Más respuestas (0)
Ver también
Categorías
Más información sobre Histograms en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!