0
$\begingroup$

Why in the attached image for a simple 3 point moving average that has been converted into a TF (z domain) is there a wired dip? It seems that when I change the sampling time, the dip shifts to the right. And why does the black veritable line at the end seem to be equal to 𝜋/𝑇? It looks like the black line is 2𝑥 frequency of the systems bandwidth so I'm assuming it is related to the Shanon limit for sampling? In what world does the output to a moving average just suddenly cease to exist, or go to zero at the dip?

enter image description here

I am in the 1st year of control stuff. Thanks for the help

$\endgroup$
1
  • $\begingroup$ That black "veritable line" is put there by your plotting software. $\endgroup$
    – TimWescott
    Apr 19 at 23:25

1 Answer 1

1
$\begingroup$

Before diving into discrete systems it may be a good idea to get familiar with the sampling theorem, how it's derived and what its consequences are.

Discretization in time corresponds to periodicity in the frequency domain (and vice versa). In your case, you seem to have sampled at 1Hz, which means the frequency domain is periodic with 1Hz. Since your time domain signal is also real, $x \in \mathbb{R}$, the spectrum is also conjugate symmetric i.e. $H(-\omega) = H^*(\omega)$.

So the most common convention is to just draw the spectrum from $0$ to $f_s/2$ (called Nyquist frequency) where $f_s$ is the sample rate. You CAN draw outside this range, but there is no new information, just repetition of the data you already have.

You should also note, that sampling can only be done without error if the bandwidth of the continuous signal is less than half of the sample rate. That's not the case here, so you end up with a good chunk of aliasing.

And why does the black veritable line at the end

I assume that's what your plotting routine does to indicate the Nyquist frequency.

In what world does the output to a moving average just suddenly cease to exist

It does not cease to exist and you certainly can plot it there, but you probably shouldn't unless you have a very specific reason to do so. It's just a periodically repeated.

Here is a graph that plots the transfer function from -0.5Hz to 2.5Hz. Since it contains negative frequencies I can only plot this on a linear frequency scale.

enter image description here

$\endgroup$
2
  • $\begingroup$ I dont think i can thank you enough for the reply there! Apologies i forgot to mention the sampling rate for the bode plot given was 20seconds. So just a couple more questions,, i was always told u have to sample at 2x the bandwidth, but from the the bode and graph that looks to be around 2pi/T, is that just a coincidence? Also is the steep dip in magtnitude and phase change before the shannon limit just the behavouir of the averaging filter? Thanks $\endgroup$ Apr 20 at 11:56
  • $\begingroup$ 1) Your signal has infinite bandwidth, so you can't sample at twice the bandwidth. You have to pick a suitable sample rate and live with the aliasing. 2) The dip at $2\pi/T$ is the first zero of the comb filter. It's simply a function of the filter coefficients. If you make the filter longer you will see more of these and at lower frequencies. $\endgroup$
    – Hilmar
    Apr 20 at 16:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.