How to calculate a running value of a function for every 30 samples?
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
clear all;
clc;
Nt= 2000; % Total samples
d = randn(1,Nt);
ratioCompute = sum(d)/mean(d);
I need calculate this ratioCompute for every 30 samples like a sliding window.
0 comentarios
Respuestas (1)
Chunru
el 29 de Nov. de 2022
Nt= 50; % Total samples
d = randn(1,Nt);
ratioCompute = movmean(d, 30)
4 comentarios
Kalasagarreddi Kottakota
el 30 de Nov. de 2022
Editada: Kalasagarreddi Kottakota
el 30 de Nov. de 2022
Chunru
el 1 de Dic. de 2022
They you try:
ratioCompute = movsum(d, 30) ./ movmean(d, 30);
Ver también
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!