Questions tagged [moving-average]
The moving-average tag has no usage guidance.
126
questions
32
votes
2
answers
60k
views
What is the cut-off frequency of a moving average filter?
I need to design a moving average filter that has a cut-off frequency of 7.8 Hz. I have used moving average filters before, but as far as I'm aware, the only parameter that can be fed in is the number ...
12
votes
3
answers
31k
views
Moving average vs. Moving median
I have read in many places that Moving median is a bit better than Moving average for some applications, because it is less sensitive to outliers.
I wanted to test this assertion on real data, but I ...
11
votes
5
answers
11k
views
How should a moving average handle missing data points?
I'm writing a program that averages the user's weight across different days. I'm planning to use a 5-point moving-average (current day, two before and two after). Sometimes, a data point is missing ...
8
votes
7
answers
79k
views
How to implement a moving average in C without a buffer?
Is it possible to implement a moving average in C without the need for a window of samples?
I've found that I can optimize a bit, by choosing a window size that's a power of two to allow for bit-...
7
votes
5
answers
7k
views
3dB-Cut off frequency of moving average
I've read the thread: Cut off frequency of moving average
And I use the second answer in my algorithm to calculate the 3dB cut off frequency of my filter, which works great, as my filter length is ...
7
votes
5
answers
11k
views
What Is the Transfer Function of a Moving Average (FIR Filter)?
To make post-processing easier, I export scope measurements as CSV files, which are then post-processed (mostly in Microsoft Excel, which is not the best tool for the job, but it is all I have at my ...
7
votes
1
answer
451
views
"Ensemble averaging ... cannot track dynamic changes"?
A book claims this as a motivation for introducing exponential averaging:
A disadvantage of ensemble averaging is that the resulting estimate cannot track dynamic changes occurring in the observed ...
6
votes
3
answers
1k
views
Moving average before downsampling: effect on Nyquist frequency?
First the simple questions:
Is there an effect on the Nyquist frequency when I apply a moving average filter on the raw data before I downsample?
And what does this do to aliased frequencies?
...
6
votes
1
answer
6k
views
Difference between Gaussian and moving average filters for peak detection and doppler shift detection?
Consider having a signal in the time domain, and you want to smooth the signal. Moving average and Gaussian filters that are used. How do you choose which is used for what?
What are the conditions ...
5
votes
6
answers
1k
views
Optimal $ n $ -th Order IIR /AR Approximation of a Moving Average Filter
I would like to approximate a moving average filter with an IIR filter of much lower order than the tap-length of the moving average filter. Optimality shall refer to the $L_2$ norm of the impulse ...
5
votes
1
answer
3k
views
How to decide whether to use AR or MA for smoothing data?
Imagine I've got some offline data that I want to smooth. I could use an auto-regressive or moving-average filter of some appropriate order for conducting the smoothing. On which criteria should I ...
5
votes
1
answer
309
views
Model Validation After Estimation for System Identification Task (Assistance with MATLAB Code)
QUESTION: I want to determine how well the estimated model fits to the future new data. How do I validate the estimated model...what is the procedure? After system identification, how to do model ...
5
votes
0
answers
45
views
Why use an ARMA process theory instead of just performing linear regression?
I am studying ARMA processes. At the end of the course the professor told us that estimating the next sample in an arma process using past of length $p$ (so performing a projection of $X_t$ on $\text{...
5
votes
3
answers
524
views
Frequency response of a rolling linear regression
I am looking for a way to characterise the frequency response of the slope from a linear regression. We are exploring the effect of window length of the regression to the magnitude of the slope of the ...
4
votes
1
answer
1k
views
How does this "simple filter" work?
I'm new to DSP, and I'm using this basic "1-pole LPF" Param Smooth filter which "smooth" param when I change it. The code is pretty simple:
...
4
votes
3
answers
234
views
Box filter with non integer length
I'm trying to model a sensor system that has an averaging behaviour. The frequency response is almost identical to a box filter and looks roughly like this:
Transferring this into a discrete time ...
4
votes
3
answers
6k
views
Weight vector of an exponential moving average?
With weight vector I mean the vector with weights that you have to multiply the observations in the window that slides over your data with so if you add those products together it returns the value of ...
4
votes
1
answer
2k
views
How can I smoothly interpolate between 2 position?
I've got a 1D signal (position of a servo motor over time) and I've extracted 'peaks'/'key' positions picking running average "local extrema" points.
Below is are 2 plots from 2 servos and the white ...
4
votes
2
answers
330
views
The Logic Behind Cascading a Moving Average Filter After a Median Filter
Why do we cascade a median filter and a moving average filter?
I know how each filter performs, but I do not know the difference between these two filters in denoising application and what is the ...
4
votes
1
answer
316
views
Underdetermined deconvolution of windowed output
Consider a discrete 'blurred' output $h[t]$ given by the convolution of filter $f[t]$ and signal $g[t]$. This question considers recovering $g[t]$ from a window (subset) of $h[t]$. This causes the ...
4
votes
1
answer
5k
views
Lowpass : What is wrong with average filtering?
The question is : What is wrong with averaging as low pass filter ?
The details :
I want to lowpass filter a signal to downsample it.
The constraints are : I have no RAM available and I work in ...
4
votes
1
answer
239
views
Conceptual Question from Signal Processing - Impulse Response and AR Coefficients
In continuation to the previous question Conceptual questions from signal processing I have a doubt which is: Consider an Autoregressive model (AR(2)):
$$
y(t) = ay(t-1) + by(t-2)
$$
and a FIR (...
3
votes
4
answers
518
views
Filtering Angular Measurements
I am trying to apply a filter to reduce noise in angular measurements. Since the data comes with noise, the filter needs to be able to handle measurements that are not smoothly progressing; for ...
3
votes
1
answer
2k
views
Equivalent 2D mask of moving-average
I have the moving-average mask as
mask = [1 1 1; 1 1 1; 1 1 1];
and then I compute the convolution 3 times
...
3
votes
3
answers
2k
views
Averaging filters
If a signal undergoes repeated averaging (n times) with a filter (h) of size m. Is it possible to achieve the same averaging result with an averaging filter(H) of a larger size?
h = {1/m, 1/m... m ...
3
votes
4
answers
2k
views
Is there an algorithm for second order filtering of data where the filter frequency is not known a priori?
It is well known that a moving average algorithm done in the time domain is equivalent to a filter with frequency response $\mathrm{sinc}(\omega\tau)$ where $\tau$ is the averaging time. (see this ...
3
votes
1
answer
114
views
How to interpret power of a two-point average signal
Consider a DT signal $x[n]$. Define the two-point moving average signal :
$$
y[n]:=\frac{1}{2}x[n]+\frac{1}{2}x[n-1]
$$
Define :
$$
\langle x[n]\rangle:=\lim_{N\to\infty}\frac{1}{2N+1}\sum_{n=-N}^{N}x[...
3
votes
1
answer
659
views
moving average rounding error analysis
I have implemented a moving average, similar to the Hogenauer Filter, with a reduced number of computation operations. I expect the expected error to behave as the random walk and its STD to be of ...
3
votes
1
answer
89
views
Envelop detection with low sample rate?
I have a signal up to $3\textrm{ MHz}$. The ADC that sample it has a rate of $1.5\mu s$. So a full $T$ of the signal is $0.3\mu s$, and I can only sample each $1.5\mu s$. It sounds not enough, but I ...
3
votes
1
answer
781
views
Determination of periodicity in data and finding mean
I have to find whether there is any pattern (I mean periodicity or close to periodicity) and if there is, for one cycle i have to perform numerical integration to determine mean. In the first picture ...
2
votes
2
answers
2k
views
Moving Average for Notch filtering
I have a periodic signal(ECG) with period of ~1 seconds. It does not have features that are shorter than 0.04 seconds. For removal of 60Hz, I thought instead of implementing a notch filter, doing a ...
2
votes
3
answers
443
views
Determining Loss of Information by Taking Average (Mean of Signal)
So basically information is defined by expected value of Shannon's information i.e. Entropy. I am curious how much information is lost if we simply take the average of the sample given to us. I am ...
2
votes
1
answer
495
views
Is it correct to call a Savitsky-Golay filter of degree 0 a simple moving average?
I had this question after seeing that polynomial regressions fit polynomial functions of different degrees to a time-series, since the mean of a time series is a constant and that a constant is also a ...
2
votes
2
answers
920
views
MAD and RMS SNR relation
Recently I've found a formula relating mean average deviation (MAD) SNR to root mean square (RMS) SNR:
$$\text{SNR}_\text{MAD} = \sqrt{\frac{2}{\pi}} \text{SNR}_\text{RMS} $$
which assumes Gaussian ...
2
votes
2
answers
571
views
Why couldn't I reapply a LPF to remove more noise?
I have a piece of raw accelerometer data consisted of 10,000 samples to be processed offline. Since the movement or rotation of the object is moderately slow and smooth, I would think that I can ...
2
votes
1
answer
457
views
How to approximate a moving RMS without iterating over N samples for each required output?
I have a signal with a sampling rate of F Hertz.
From it I want to produce an RMS signal, also with F samples per second with a window size of N samples.
Using a standard moving RMS algorithm I must ...
2
votes
1
answer
197
views
A general conceptual understanding of moving average
I have a conceptual question here. I understood how to calculate a Moving Average(MA).
For example :
x(n) = 0, 1, 2, 3, 4, 5
MA = 0, 1/2, 3/2, 5/2,7/2, 9/2, where for calculation of the MA we only ...
2
votes
1
answer
322
views
Allan deviation to determine averaging time
Thanks in advance for the help. I don't post on here often, so I hope I can convey my question properly.
I think I understand what the Allan deviation (same as IEEE Allan variance?) does. You take a ...
2
votes
1
answer
141
views
Terminologies - lags, order in time series model
I am facing some difficulties with the terminologies - lag ($p$) and sequence length (number of data points) (N) used in time series model such as Moving average and Autoregressive model. Considering ...
2
votes
1
answer
7k
views
Phase response of moving average filter -- how to interpret?
There are many articles on the frequency response of the moving average filter but they all seem to focus on magnitude. However the phase response is intriguing and I find it hard to interpret. The ...
2
votes
2
answers
5k
views
Is this code for doing a moving average correct?
Is this code for doing a moving average correct?
y=conv(x, ones(1,100)/100);
I want to filter my speech signal with moving average filter in code. I think that ...
2
votes
1
answer
613
views
Gain function calculation (frequency response)
Define moving average process $y_t := 0.5 x_t + 0.5 x_{t-1}$ where $x_t := e^{i2 \pi t}$. Its frequency response is then:
$$H(f) = 0.5 + 0.5 e^{-i2\pi f}$$
Recall that the frequency response in ...
2
votes
1
answer
542
views
How to filter a signal using a bandpass filter consisted of two moving average filters?
I want to filter a PPG signal on a microcontroller. I have limited memory and a was searching for low computational methods. I found the work of Kazuhiro Taniguchi, Earable POCER: Development of a ...
2
votes
2
answers
575
views
Mean delay for a M tap harmonically weighted filter
I am trying to derive the mean delay for $M$ filter taps harmonically weighted:
$$y[n] = \frac{M\,x[n] + (M-1)x[n−1]... + 1 \cdot x[n−M+1]}{\tfrac12 M (M + 1)}$$.
For a uniformly weighted filter, I ...
2
votes
1
answer
163
views
What happens when filter ringing is far longer than the signal itself?
I'm digging into some (quite popular in my field) analytical practice that I find suspicious. The problem is to remove the trend from some very short (eg. 18-40 data points representing 200 - 800 ms) ...
2
votes
1
answer
616
views
autoregressive moving average code implementation
I am new to DSP and i am trying to take a wav (human speech) file and apply ARMA filter and plot its PSD graph in python.
I see that there are a lot of AR implementations but almost none ARMA. I ...
2
votes
1
answer
178
views
Generalized/Power means in DSP
Generalized/power means may be used to construct moving-average filters with different properties than regular one which is based on arithmetic mean. This observation seems to be trivial - even ...
2
votes
1
answer
188
views
What are the ripple and attenuation in a set of moving average filters?
Ladies, Gentlemen,
Consider following set of moving average filters:
(1) - 100 coefficients equal to 1/100
(2) --- 95 coefficients equal to 1/95
(3) --- 90 coefficients equal to 1/90
(4) --- 85 ...
2
votes
1
answer
579
views
Taking the Moving Average of STFT Results
I realize that this seems redundant, but I'm getting consistently better results when performing machine learning techniques that use spectral features extracted using the moving average process below,...
2
votes
1
answer
161
views
How to remove historical values from exponential filter
Suppose I have two time series $A:=[0,0,0,4,5,6]$ and $B:=[1,2,3,4,5,6]$. I implement the following filter (with initial value at the first element):
$$ f(t) = f(t-1) + \alpha*(f(t)-f(t-1))$$
with $\...