im working on a program in matlab for calculation of sampled signal spectrum, and I have a sinusoidal signal with frequency f=100 Hz, sampling frequency fs=250 Hz, every sample is repeated 4 times (fr=1000 Hz), my spectrum got this series of frequencies: 100, 150, 350, 400, 600, 650, 850, 900 [Hz] so: f, fr/4-f, fr/4+f, fr/2-f, fr/2+f, 3fr/4-f, 3fr/4+f, fr-f

I know the relations between fr and f, but I don't know how to describe it with a singular function; when repeating samples 2 times (fr=500), it gives me the same visible peaks at 100, 150, 350 and 400 Hz

I could't find anything about this anywhere (at least for free) :(

All I need is a formula that tells me where those peaks are if I sample a signal of frequency f at the sampling frequency fs and the samples are repeated r times... Repeating samples in my case is making {abc} into {aabbcc}

In this image, fs = 250Hz, r=4, f = 100Hz spectrum of resampled signal

  • $\begingroup$ ”every sample is repeated 4 times (fr=1000 Hz)” what does this mean? Can you share your code please? $\endgroup$
    – Jdip
    Commented Mar 28 at 17:21
  • $\begingroup$ Do you want a measure of periodicity of a signal? $\endgroup$ Commented Mar 28 at 17:36
  • $\begingroup$ The thing is, i just need a mathematical formula to describe where those peaks are in respect to the sampling frequency, the resampling constant and the frequency of the signal, so I don't think I want the measure of periodicity the fr= 1000 Hz is the fs times 4 (the resampling constant), so, frequency of resampling (fr for short) $\endgroup$
    – Wiktuur
    Commented Mar 28 at 19:36
  • $\begingroup$ sounds like you want what is usually called "relative frequency", i.e. the frequency of anything divided by the sample rate (or, saying the exact same thing, the amount of signal periods per sample period) $\endgroup$ Commented Mar 28 at 20:00

1 Answer 1


You are sampling, then resampling, then (essentially) filtering. Everything that you see can be explained because of the combination of these effects.

You're starting with a signal at 100Hz: $x(t) = \cos 2 \pi 100 t$.

Then you're sampling it once, at 250Hz: $x_n = \cos 2 \pi \frac{100}{250} n$.

At this point, aliasing happens. Why? Because $\cos \theta = \cos (2 \pi + \theta)$, and because for every integer $n$ there's an integer $m_n$ such that $$x_n = \cos 2 \pi \frac{100}{250} n = \cos \left(2 \pi m_n - 2 \pi \frac{150}{250} \right) \tag 1$$

If you work this out, you have frequencies at $100\mathrm{Hz} \pm 250 \mathrm{Hz}$

If you plotted the spectrum of just your signal sampled at 250Hz, you'd see content at 100Hz and 150Hz -- this is why.

Then you're resampling it again, and (effectively) filtering it with a filter whose impulse response is four '1's in a row.

The effect of resampling it means that the spectrum of the original signal will get replicated at 250Hz intervals. This is why you have spikes at 100, 150, 350 (100 + 250), 400 (150 + 250), et cetera.

If you resampled by just emitting one of your 250Hz samples at 1kHz and then three zeros, then one sample, etc., then all of your spectral spikes would be the same size. However, by replicating the samples, you are, effectively, low-pass filtering it with a filter whose impulse response is $$h_k = \begin{cases} 1 & 0 \le k < 4 \\ 0 & \mathrm{otherwise} \end{cases} \tag 2$$


Your Answer

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

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