Smoothing discrete data with hanning window

I am new to matlab analysis and I need to smooth dicharge times of a motor unit (discrete data points representing firing times). All previous literature uses "400 ms Hanning window" to smooth the firing rate (calculated from the discharge times). My question is, I have ,for example, an array containing 800 numbers (consecutive discharge times in sec) . How can I apply 400 ms Hanning window on this data? My sampling rate is 20K Hz.

2 comentarios

Adam
Adam el 29 de Ag. de 2018
You have nowhere near enough data to do this. 800 samples is only 4ms worth of data unless my on the spot maths is wrong.
Star Strider
Star Strider el 29 de Ag. de 2018
See the fir1 documentation section on Multiband FIR Filter (link) for an example on how to design a FIR filter with a Hanning window.

Iniciar sesión para comentar.

Respuestas (2)

innavoig23
innavoig23 el 11 de Feb. de 2025

1 voto

I just created a repo on GitHub since I needed to do that too for my MSc thesis. Here's the link.
Adam Danz
Adam Danz el 29 de Ag. de 2018

0 votos

Here's a full description and examples.

5 comentarios

Gizem Yilmaz
Gizem Yilmaz el 29 de Ag. de 2018
Thank you for your help, but I have already went through help pages. the problem is I have an array (1x800) which contains firing times in seconds. Even if I convert time into samples, data size do not change. When I create a Hann window of 400 ms, doesn't it mean that my window size L will be L=0.4*fsamp ? In my case, the samp.rate is 20k Hz and L will be 8000 points. How can I use this window on my 800 points data? I might be getting a concept wrong, if so, what might it be in terms of filtering?
Adam Danz
Adam Danz el 29 de Ag. de 2018
See Adam's comment under your question. I agree that if your sampling rate is 20Khz and you've got 800 samples, you simply don't have enough data to use a 400ms window.
20kHz is 0.05 milliseconds per sample. If you have 800 equispaced samples at that rate, that's only 40ms.
Gizem Yilmaz
Gizem Yilmaz el 29 de Ag. de 2018
I got this,however, my problem is that my data is not "800 equispaced samples". In my discharge times array I have indepented discharge times in sec, for example [16.75 16.9 18.12 .... 200.54]. I need to follow Hann windwing approach. I don't know how to pass my discrete data through hann window...
Adam
Adam el 29 de Ag. de 2018
If that is the case how can you have a single sample rate? A scalar sample rate implies all data is the same distance apart on a uniform grid.
@Gizem, If I'm interpreting your description correctly, you've sampled a motor unit at 20kHz and recorded the timestamps of each action potential. For simplicity, let's say the sampling rate was at 1ms intervals (1kHz), if my timestamps were
[2 5 7 10]
then I could replace that with a vector sampled a 1ms resolution where a 1 indicates a spike.
[0 1 0 0 1 0 1 0 0 1]
There is a 1 (a spike) at 2ms, 5ms, 7ms, and 10ms.
Is that an accurate description of your data?

Iniciar sesión para comentar.

Preguntada:

el 29 de Ag. de 2018

Comentada:

el 11 de Feb. de 2025

Community Treasure Hunt

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

Start Hunting!

Translated by