This will probably be an extremely simple question for some one with any background in signal processing(not my background)

Let say I have signal $$x(t)=A\sin(\omega t)$$ where A is known and $\omega$ is unknown. Let say I only observe a noisy signal of $x(t)$ at discrete time periods $t=1,2,3....$. My signal $y(n)$ has the following form $$y(n)=x(n)+\epsilon$$ where $\epsilon\sim N(0,\sigma^2)$. My question is , what would be the best estimate of $y(n+1)$ given the observations till time time period $n$.

  • 2
    $\begingroup$ Assuming you have n evenly spaced samples of the noisy sine wave, why not curve fit a sine wave to the samples and then evaluate that fitted sine wave as desired? $\endgroup$ – Ed V Sep 21 '19 at 22:04
  • 1
    $\begingroup$ tracking in this context typically means that the frequency varies over time. does your sine frequency shift with time? $\endgroup$ – user28715 Sep 22 '19 at 1:47
  • $\begingroup$ Hello, fortunately, the frequency does not vary with time?Also, can you guide me resources to read about curve fitting a sine wave? $\endgroup$ – kangkan Dc Sep 22 '19 at 12:00
  • 1
    $\begingroup$ @kangkanDc too bad your frequency is fixed. There is a lot of material on using an extended Kalman filter for the slowly varying frequency problem. The EKF includes a prediction step. why do you need to predict the future sample? $\endgroup$ – user28715 Sep 22 '19 at 14:54
  • $\begingroup$ Imagine that one has an asset whose value varies periodically with fixed frequency(our x_t). Suppose one has a stock whose price depends noisily on the value of the asset (our y_t). In this situation, one would want to have the best prediction of y_t $\endgroup$ – kangkan Dc Sep 23 '19 at 8:49

That's actually not a trivial problem and the best approach really depends on your specific requirements.

My first approach would be a phase-locked loop and simply use the local oscillator as the predictor (with proper amplitude scaling). This can give you extreme accuracy if you are willing to pay with time.

| improve this answer | |
  • $\begingroup$ Thanks. is there any online resource that you can guide me to? $\endgroup$ – kangkan Dc Sep 22 '19 at 12:00
  • $\begingroup$ The PLL would be great for on-line estimation $\endgroup$ – Ben Feb 19 at 3:06
  • $\begingroup$ But maybe overkill for offline estimation $\endgroup$ – Ben Feb 19 at 3:06

We can do it in 2 simple steps:

  1. You can actually estimate $\omega$ of your input signal easily by taking FFT of the measured n samples. I am suggesting this only because offline processing is an option, otherwise this would be pretty computationally costly.

  2. Once you have a close estimate of $\omega$, then you can use Weiner filtering to predict $x[n]$ from the observation $y[n]$.

I am giving explanation of how $\omega$ can be estimated using FFT.

Assuming, you are sampling the received signal at a sufficiently high $f_{s}$, FFT is a very simple and effective approach to estimate both frequency and phase of the sinusoid.

For example, let $A=1$, $f_{c} = 100Hz$ which is unknown and $f_{s} = 1000Hz$. Then sampled signal will be: $$x[n] = sin[2\pi \frac{f_c}{f_s} n]$$ and, $$y[n] = x[n]+w[n]$$, where $w[n]$ is AWGN with $\sigma^2$ variance and $0$ mean.

To estimate $f_c$, you can take 2048-point FFT of suppose 2048 samples of received noisy $y[n]$ and find the earliest peak above noise level in $Y[k]$. (Earliest, because you will get 2 peaks: one at +ve frequency and one at -ve frequency).

Suppose, the earliest peak is at $k^{th}$ DFT coefficient, then the $f_c$ estimate will be given by: $$\hat{f_c} = k*\frac{f_s}{FFT_{length}}$$.

A MATLAB Simulation and analysis is provided below:

fc = 100;              % signal frequency
fs = 1000;             % Sampling Frequency
n = (0:10000);
x = sin(2*pi*fc*n/fs); % sampled input
y = awgn(x, 3);        % 3dB SNR
figure(1);plot(y);hold on;plot(x)

Y = fft(y(350:350+2047), 2048); % 2048-point FFT of any 2048 length window

Figure(1) plots the transmitted signal $x[n]$ and received noisy signal $y[n]$. I have assumed 3dB SNR.

Sinusoid + AWGN

Figure(2) plots the 2048-FFT of a window of received y[n] samples from $n = [350, 350+2047]$. You can take any 2048 length window of $y[n]$ and take its FFT. You can even experiment with FFT length to suit your needs.


You can write a simple algorithm to find the peak, I have just marked it in the plot to keep the MATLAB script relevant.

You can see that the peak is at $k=205$, MATLAB shows 206 because it starts counting from 1.

Therefore, estimated $f_c$ will be : $$\hat{f_c} = k*\frac{f_s}{FFT_{length}} = 205*\frac{1000}{2048} = 100.0977Hz$$, which is pretty close to the original input signal $x[n]$.

You can explore more on the following :

1. What are the factors which will degrade or improve the performance of this frequency estimator?

2. If input $x[n]$ had an initial phase $\phi$, how can you estimate that phase?

| improve this answer | |
  • 1
    $\begingroup$ Exploration tips: Estimating the frequency to the nearest bin is known as "coarse estimation". Estimating it to a higher resolution is known as "fine estimation". Do a search on "fine frequency estimation" and you will got lots of approaches, all improvements on coarse estimation. My phase and amplitude estimation article is one of the most read: dsprelated.com/showarticle/787.php I improved it my "unfurling" the vector as shown here: dsprelated.com/showarticle/1284.php It takes a bit of depth of understanding to know why it works so well. $\endgroup$ – Cedron Dawg Apr 6 at 12:17
  • 1
    $\begingroup$ @CedronDawg Thanks, for the suggested read. The articles are nicely explained and detailed. It will take me some time to read them completely but I know it's worth the time. $\endgroup$ – DSP Rookie Apr 6 at 14:32
  • $\begingroup$ I can't argue with any of that. Enjoy and may your journey be pleasant. The articles are generally written math first are meant to be understandable math only. Most articles are of derivations of formulas from base definitions with no reliance on the continuous case. Most the formulas are novel. In other words, this isn't how it is currently taught, and for people with no need for an understanding of the continuous side of FT, I think it's better. Nowadays, in audio processing, that's probably most folks. Click on the red author tag to get to all the articles. $\endgroup$ – Cedron Dawg Apr 6 at 15:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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