How to draw an histogram?
Ältere Kommentare anzeigen
How do I draw an histogram knowing the number of times all elements in a 150x150 matrix appears using matlab?
Akzeptierte Antwort
Weitere Antworten (1)
f you already have the matrix, use it directly. If not, here is an example of how you can generate a random matrix with integers for demonstration purposes:
% Generate a 150x150 matrix with random integers from 1 to 100
matrix = randi(100, 150, 150);
% Flatten the matrix to a vector
flattenedMatrix = matrix(:);
% Plot histogram using the appropriate method
histogram(flattenedMatrix, 'BinMethod', 'integers');
xlabel('Element value');
ylabel('Frequency');
title('Element frequency in 150x150 matrix');
1 Kommentar
Prince
am 4 Apr. 2024
Kategorien
Mehr zu Histograms finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!



