Moving window percentile computation using Conv
Afficher commentaires plus anciens
Hi
How to calculate 90th percentile of signal on a moving window set by conv. function. I have came across several posts on moving average calculations, such as here: https://www.mathworks.com/matlabcentral/answers/59561-how-can-i-calculate-a-centered-moving-average-with-window-size-7
But couldn't find any function to determine percentiles.
Réponse acceptée
Plus de réponses (1)
Matt J
le 23 Sep 2024
0 votes
8 commentaires
Poulomi
le 23 Sep 2024
Poulomi
le 23 Sep 2024
Matt J
le 23 Sep 2024
No, it's just
ordfilt2(signal,round(11*.9), ones(11,1))
Poulomi
le 23 Sep 2024
Bruno Luong
le 23 Sep 2024
Modifié(e) : Bruno Luong
le 23 Sep 2024
pick the element approximate at position (90 %) of 11 sorted( elements) = 10
round(0.9*11)
t= 0:0.25:100;
y = sin(2*pi*t./max(t))+rand(size(t));
y90 = ordfilt2(y(:), round(11*.9), ones(11,1));
plot(y,'b')
hold on
plot(y90,'r.')
Poulomi
le 23 Sep 2024
Bruno Luong
le 23 Sep 2024
Modifié(e) : Bruno Luong
le 23 Sep 2024
Matt's solution picks the 10th largest elements of the neighborhood of 11 elements current index + (-5:5). This is 90.91 % (=10/11), granted not exactly 90% as requested.
If you need something different you need to explain. Not many people here can see why " Series remained constant for 4 or more data points all together, which is eroneous"
Catégories
En savoir plus sur Correlation and Convolution dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

