How to implement a sliding window with a condition
5 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
The code is supposed to show 1 when residual deviates beyond the threshold for x consecutive sample times and 0 when deviates once after y sampling time. The residual is a column matrix 2000 x1 . I tried using a sliding window approach to achieve this.
2 comentarios
Respuestas (1)
DGM
el 12 de Abr. de 2022
You can probably just use movmin().
R = rand(100,1);
th = 0.5;
w = 2;
exceeds_th = movmin(R,w)>th;
[R exceeds_th]
You can play around with the options for movmin() to adjust how it behaves.
Ver también
Categorías
Más información sobre Fortran with MATLAB 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!