Moving window percentile computation using Conv
Show older comments
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.
Accepted Answer
More Answers (1)
Matt J
on 23 Sep 2024
0 votes
8 Comments
Poulomi
on 23 Sep 2024
Poulomi
on 23 Sep 2024
Matt J
on 23 Sep 2024
No, it's just
ordfilt2(signal,round(11*.9), ones(11,1))
Poulomi
on 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
on 23 Sep 2024
Bruno Luong
on 23 Sep 2024
Edited: Bruno Luong
on 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"
Categories
Find more on Correlation and Convolution in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
