Running Average of a Massive data set

1 Ansicht (letzte 30 Tage)
Duncan Cross
Duncan Cross am 10 Dez. 2019
Kommentiert: Duncan Cross am 10 Dez. 2019
So I have a data file containing 5 seconds of sound data, where I want to smooth the data with a running average function and then use the Fast Fourier Transform function in MATLAB in order to pinpoint the amplitude spikes that should be a tuning fork and an out of tune instrument. The data has 20,000 popints, however, and the methods I've tried so far accidentially erase the information I want. Is there a way to make a running average function manually for that many data points?

Akzeptierte Antwort

Image Analyst
Image Analyst am 10 Dez. 2019
Well 20,000 points is far from massive. Maybe if it were 10,000 times that big. 20k is actually pretty small. Anyway you can use the conv() function.
windowWidth = 101; % an odd number.
kernel = ones(1, windowWidth) / windowWidth;
smoothedSignal = conv(signal, kernel, 'same');
You can also try the movmean() function if you have a recent version of MATLAB.
  1 Kommentar
Duncan Cross
Duncan Cross am 10 Dez. 2019
It's the biggest one I've had to work with, so it seems massive to me. But your code does smooth it pretty well, thank you!

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Signal Generation and Preprocessing finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by