How to find the quartiles of an array?

40 vues (au cours des 30 derniers jours)
RB
RB le 27 Fév 2018
Réponse apportée : Rajanya le 23 Déc 2024
I currently have a 1024x1024 array. I want to find the first and fourth quartile range for this array. (I already used iqr(a(:)) to find the interquartile range, however now I want to find the first and fourth). Thank you!

Réponses (1)

Rajanya
Rajanya le 23 Déc 2024
Hi @RB,
You can use 'prctile' on the flattened array to calculate the 25th percentile which in turn will give you the first quartile.
a = rand(1024,1024);
a_flattened = a(:);
out = prctile(a_flattened,25)
out = 0.2505
You can refer to the documentation page of 'prctile' for more information on the same by executing the following command from MATLAB command window.
doc prctile
Thanks!

Catégories

En savoir plus sur Descriptive Statistics and Visualization dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by