Sliding window central value divided by window RMS

3 visualizaciones (últimos 30 días)
davisw
davisw el 29 de En. de 2018
Comentada: Jos (10584) el 29 de En. de 2018
Hello. I have a large data set and I am trying to write a function where I can take a sliding window and use the central value in the window and divide that by the RMS. Its pretty much to generate a Automatic Gain Control for RMS. I have tried the following to get the moving RMS, but I am stuck on how to incoporate the central value and dividing it by the window RMS. So far I have this:
data = load('datafile');
movRMS = dsp.MovingRMS(5); %window length 5
z = data./movRMS(data);
Any help would be really appreciated. If there is a better way to do this without using dsp.MovingRMS such as loops I would give that a shot too, I am fairly novice at Matlab. Thanks

Respuestas (1)

Jos (10584)
Jos (10584) el 29 de En. de 2018
Maybe you can use my function SLIDEFUN which you can download from the File Exchange: https://uk.mathworks.com/matlabcentral/fileexchange/12550-slidefun
RMSfun = @(x) sqrt(sum(x(:).^2)/numel(x))
data = [1 1 1 2 2 3 3 2 2 4 4]
movRMS = slidefun(RMSfun,3, data)
corrected_data = data ./ movRMS
  1 comentario
Jos (10584)
Jos (10584) el 29 de En. de 2018
If you have movmean, you can also use
movRMS = sqrt(movmean(data.^2,3))
rather than slidefun, of course :)

Iniciar sesión para comentar.

Community Treasure Hunt

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

Start Hunting!

Translated by