Skip to main content
8 votes
Accepted

How does this "simple filter" work?

In more standard DSP terms, you have the following filter: $$ y[n] = (1-a) x[n] + a y[n-1] $$ where $x[n]$ and $y[n]$ are the input and output signals at time $n$ respectively. The transfer ...
Juancho's user avatar
  • 5,026
7 votes
Accepted

Moving Average for Notch filtering

No you are not missing anything. A moving average with a period of $T = 1/60$ seconds will indeed have a notch at 60 Hz, since the frequency response is a Sinc function with the first null at 1/T. (...
Dan Boschen's user avatar
  • 52.3k
7 votes
Accepted

Is it correct to call a Savitsky-Golay filter of degree 0 a simple moving average?

Yes you can consider a zeroth (or first) order SG filter as a moving average filter. Below MATLAB / Octave code computes the impulse response of a SG filter of order $N$ and length $2M+1$ : ...
Fat32's user avatar
  • 28.3k
7 votes
Accepted

Moving average before downsampling: effect on Nyquist frequency?

There is no effect on the Nyquist frequency, which is only dependent on the sample rate. Decimating is the combination of low-pass filtering + downsampling (which is the term for discarding samples ...
Jdip's user avatar
  • 6,300
6 votes
Accepted

What Is the Transfer Function of a Moving Average (FIR Filter)?

The frequency response of the moving average is called the asinc or psinc, the aliased sinc or periodic sinc (sinc for cardinal sine), or the Dirichlet function. Since the sum of the moving average ...
Laurent Duval's user avatar
6 votes

Filtering Angular Measurements

If a first-order IIR will do, modify that slightly, and you're done. So the usual first-order low-pass filter can be defined as $y_n = h(\theta_n)$ such that $y_n = y_{n-1} + a(\theta_n - y_{n-1})$. ...
TimWescott's user avatar
  • 12.9k
5 votes

What Is the Transfer Function of a Moving Average (FIR Filter)?

The following figure is borrowed from Frequency Response of the Running Average Filter: This is the gain applied to different frequencies (normalized to interval 0-$\pi$), for running averages of ...
Laurent Duval's user avatar
5 votes
Accepted

How to interpret power of a two-point average signal

$⟨x[n]x[n−1]⟩ $ represents a correlation between the sample $x[n]$ and the previous sample $x[n-1]$. The sum of a sample and it's previous divided by two is a two sample moving average. A moving ...
Dan Boschen's user avatar
  • 52.3k
4 votes
Accepted

Moving Average of sinusoid

The fundamental property of averaging filters (in swear words, a linear system) is that the output of a sine is a sine of the same frequency, albeit of zero amplitude. So: Which non-trivial moving ...
Laurent Duval's user avatar
4 votes

Optimal $ n $ -th Order IIR /AR Approximation of a Moving Average Filter

(Update: I just realized that the first part of this covering CIC structures is basically what Hilmar has already answered-- I'll leave this up since it offers more graphics and details in case that ...
Dan Boschen's user avatar
  • 52.3k
4 votes

Optimal $ n $ -th Order IIR /AR Approximation of a Moving Average Filter

This is not a full answer. It explores some basic approximations. For a moving average as long as 600 samples it is informative to look at impulse responses of continuous-time filters as ...
Olli Niemitalo's user avatar
4 votes
Accepted

Optimal $ n $ -th Order IIR /AR Approximation of a Moving Average Filter

I can show you some low order IIR approximations to an FIR moving average filter. In the figure below you see $3$ (infinite) impulse responses that approximate a moving average of length $N=600$. The ...
Matt L.'s user avatar
  • 90.5k
4 votes
Accepted

A general conceptual understanding of moving average

That system you're referring to is a first-order recursive filter $$y[n]=\alpha x[n]+(1-\alpha)y[n-1],\qquad 0<\alpha<1\tag{1}$$ where $n$ is the (integer) time index, $y[n]$ is the output, ...
Matt L.'s user avatar
  • 90.5k
4 votes
Accepted

How to approximate a moving RMS without iterating over N samples for each required output?

There is a way to do it, it is really similar to a moving average $N$ : number of samples per period $Z$ : Accumulator $x[n]$ : current sample $$Z[n] = Z[n-1]+ x[n]^2 - x[n-N]^2 $$ $$x_{RMS}[n] =...
Ben's user avatar
  • 3,777
4 votes

Amplitude reduction of Simple Moving Average on sinusoid

Below is the analytic result for both the actual max value of $0.901243$ and the maximum value found by the OP of $0.898464$ The reason you are not getting the predicted maximum is your samples of ...
Dan Boschen's user avatar
  • 52.3k
4 votes
Accepted

moving average rounding error analysis

The OP is implementing the Hogenauer Filter (thank you Eugene! http://read.pudn.com/downloads163/ebook/744947/123.pdf), also called a CIC Filter, as an efficient equivalent of the moving average ...
Dan Boschen's user avatar
  • 52.3k
4 votes

Filtering Angular Measurements

Median filtering is non-linear, and pretty awesome about removing outliers. You just need to adjust the length of the filter based on the estimate of the frequency of the errored samples.
IanJ's user avatar
  • 244
4 votes

Why couldn't I reapply a LPF to remove more noise?

Answer Your "LPF" (as Tim mentioned in his answer, a moving average is also a Low Pass Filter) isn't nearly as strong as you think it is. To match your Moving Average response, you need $\...
Jdip's user avatar
  • 6,300
4 votes
Accepted

Allan deviation to determine averaging time

What the OP is seeing in lower and lower noise as the averaging duration increases makes sense as the capture duration itself has not changed. It is the duration of the capture that will limit the ...
Dan Boschen's user avatar
  • 52.3k
3 votes
Accepted

Group delay of moving average filter

"Group delay" isn't the delay between the change on the input and the first effect; it's the delay that a packet of oscillations of different frequencies experience. In the case of a linear phase ...
Marcus Müller's user avatar
3 votes
Accepted

Terminologies - lags, order in time series model

Q1: should the model generate a time series of length 'N=16` i.e, would the output of the above model $\mathbf{y} = [y_1,y_2,\ldots,y_N]$ contain 16 elements where $n = 1,2,\ldots,16$? If one thinks ...
Peter K.'s user avatar
  • 25.9k
3 votes
Accepted

$N$ point moving average filters in state space

Yes sure they are LTI. Let $A$ be the $(L-1)\times (L-1)$ shift matrix $$ A := \begin{pmatrix}0 & 1 & 0 && \dots & 0\\0 & 0 & 1 & 0 &\dots &0\\\vdots &&...
LJSilver's user avatar
  • 768
3 votes

Difference between Gaussian and moving average filters for peak detection and doppler shift detection?

A centered moving average filter is a finite impulse response (FIR) filter that affects the same weight to all the samples in the window. If you only care about time domain properties, and do not care ...
Laurent Duval's user avatar
3 votes
Accepted

MATLAB: Implementing Least Squares Estimator for a Given Model

The equation you're trying to solve is $$ \mathbf{y}=\mathbf{X}\mathbf{h}, $$ where $\mathbf{h}$ is your unknown. The matrix $\mathbf{X}$ is going to have a time-shifted structure that reflects the ...
David's user avatar
  • 2,871
3 votes
Accepted

How to apply least-squares estimation for sparse coefficient estimation?

I am not entirely sure what Matlab's LASSO routine does so I started with Ordinary Least Squares (OLS) and worked backwards. From an OLS perspective X1 as you have it won't work. You've got a ...
Chad Sexington's user avatar
3 votes

MAD and RMS SNR relation

First post here, so apologies for any mistake I will no doubt make. I think I would add more to the existing answer by the excellent Laurent Duval, because the original poster used MAD, which usually ...
astabada's user avatar
  • 131
3 votes
Accepted

MAD and RMS SNR relation

The two main measures of scatter in the Gaussian case are the mean absolute deviation: $$d_n = 1/n\sum |x_i-\overline{x}|$$ and the mean square deviation: $$s_n = \sqrt{1/n\sum (x_i-\overline{x})^2}...
Laurent Duval's user avatar
3 votes

Envelop detection with low sample rate?

Is the ADC sample-and-hold fast enough to even capture any envelope peaks or even half cycles? If not, all bets are off. If your ADC does have a fast enough capture time, then randomizing your ...
hotpaw2's user avatar
  • 35.4k
3 votes

Optimal $ n $ -th Order IIR /AR Approximation of a Moving Average Filter

Depends a bit on your application. A moving average filter is a low pass filter and one with many lobes and pretty poor stop band rejection at that. Depending on what specific requirements you have, ...
Hilmar's user avatar
  • 45.6k

Only top scored, non community-wiki answers of a minimum length are eligible