# Estimating spectrum with regularly missing samples from data

Suppose: $$s(t) = \sin(2\pi{f_0}t)$$

Suppose I'm sampling the signal with a sample frequency $$f_s >2f_0$$ .
However, every $$M$$ samples there is a dead-time of $$L$$ samples.

Traditionally, the (continuous) sampling function is just a delta comb function: $$p(t) = \sum_{n=-\infty}^\infty \delta(t-nT_s) , \quad T_s=1/f_s$$ However, in my scenario the impulse train misses some impulses in repetitive way. Here's the mathematical description:

1. Start by defining: $$v(t) = \sum_{n=0}^{M-1} \delta(t-nT_s)$$ This represents essentially 1 frame in which M samples are sampled.

2. Denote $$K = (M+L)\cdot{T_s}$$ , the period between subsequent frames. Then, I could define: $$r(t)=\sum_{l=-\infty}^{\infty} v(t-lK)$$

Here's a graphical representation:

So my question is, how can I obtain a good estimation of the FFT of s(t)?

Bonus question: what happens if K isn't an integer multiple of $$T_s$$ ?

• yeah you can, though the FFT is not what you really want to estimate if you know your signal consists of a single oscillation; all the information would be in the parameter $f_0$ that you could estimate just as well. Now, do you really want to estimate the DFT?Or do you want to estimate the frequency? Or is your signal model possibly a bit more complicated, e.g. with more than one oscilation? Nov 7, 2023 at 15:13
• In lieu of a good answer I could squeeze in, here's the term you want to research: Compressed sensing (or compressive sensing, sampling). Your example is practically the standard entry point for illustrating why it works (To identify the frequency of a noise-free single-tone signal, you'd need, worst case, three samples that aren't equally spaced; you have a linear system that's overdetermined, so you can delete a lot of coefficients until you have a problem. And in noise, you can still do a however-you-defined-error least-error estimate with much fewer than $M$ coefficients.) Nov 7, 2023 at 15:19
• I'm trying to understand how this form of sampling influences the DFT. In a real-life scenario, I'd be using this sampling scheme 100 frames. And I'd be interested to recover a clean DFT of the physical signal. Nov 7, 2023 at 15:50
• yes, but you can recover a clean DFT most easily be estimating $f_0$ and then just creating the DFT of the tone at the receiver. I mean, the DFT of a single tone is trivial – it's just the sinc with $f_s/N$ inter-zero distance, shifted to $f_0$, sampled at $f_s/N$, where $N$ is the length of your DFT. That's why I ask whether your signal model is really this simplistic! Nov 7, 2023 at 15:54
• Ah, well in practice my signal will be much more complicated, it will actually consist of an audio signal. That's why I'm trying to understand first the basic behavior on a simple signal. Nov 7, 2023 at 15:56

This answer to my related question on nonuniform sampling gives the formula for how the spectrum is distorted by this type of periodic non-uniform sampling.

If you're more interested in simply calculating the spectrum of the non-uniformly sampled signal, there are 3 ways I can think of off the top of my head:

• Thanks! I've actually already tried the lomb-scargle periodogram, however I see 2 problems with the LS periodogram. 1. there isn't a good method to filter out noise out of my data (since filtering requires uniform sampling rate) 2. Also, in my example, the samples aren't just sampled at random times (for which the LS periodogram is much better of a method), but the sampling scheme has a repeating pattern, which makes me wonder if there is some way to perhaps reconstruct the original signal somehow Nov 11, 2023 at 19:54
• I don't think you'll be able to reconstruct it perfectly. That information is lost. But the answer I linked to at least tells you exactly how the spectrum is corrupted. Another thing you could do is take a STFT, looking at the spectrum of the sampled segments of your signal. Nov 12, 2023 at 1:20

In fact, there are tools that can provide a good DFT estimate of s(t).

I recommend the EDFT program written in Matlab code and available on fileexchange. To calculate the DFT, first create input sn where L missing samples replaced by NaN ('Not a Number' in Matlab) in s and run command:

F = edft(sn);


You can calculate the inverse Fourier transform as:

s* = real(ifft(F));


to check how EDFT fills NaNs in sn with interpolated data.

EDFT is also applicable if K is not an integer, then s(t) should be specified as two vectors - available data (s) and sample points (t), as well as DFT frequencies

f = (-ceil((N -1 ) )/2):floor((N-1)/2))/N/Ts;


where N shouldn't be less than (L+M)*(number of frames):

F = edft(s,f,[],[],t);
`