Signal Reconstruction: Using FFT to Approximate a Signal with Two Frequencies

  • MATLAB
  • Thread starter member 428835
  • Start date
  • Tags
    Signal
  • #1
member 428835
I am trying to reconstruct a signal, and looked at this example: https://www.mathworks.com/help/matlab/ref/fft.html

Towards the middle of the page, there are two frequencies: 50 Hz and 120 Hz. How can I approximate reconstruct the initial signal given these two numbers? What I've been doing so far is literally writing out sines and cosines but I know there has to be a robust way to do this, likely using the ifft function.

Thanks so much for looking at this.
 
Physics news on Phys.org
  • #2
I'm not sure what you mean by "literally writing out sines and cosines". Do you mean evaluating the expression A * sin(ft)? And what do you mean by "robust"?

The plot you're looking at shows magnitude only. In order to accurately reproduce the original signal you need the phase information. That would be contained in the complex FFT but not in the real-valued power spectrum plot.

If you have the complex FFT, then IFFT is what you need to go back to the time domain. But frankly I don't see anything wrong with just calculating the sine at each time sample (appropriately phase shifted) if you only have a couple of frequencies.
 
  • #3
RPinPA said:
I'm not sure what you mean by "literally writing out sines and cosines". Do you mean evaluating the expression A * sin(ft)? And what do you mean by "robust"?
Yes, this is what I've been doing. By robust, I mean not literally typing sines and cosines for say the 10 most dominant frequencies.

RPinPA said:
The plot you're looking at shows magnitude only. In order to accurately reproduce the original signal you need the phase information. That would be contained in the complex FFT but not in the real-valued power spectrum plot.

If you have the complex FFT, then IFFT is what you need to go back to the time domain. But frankly I don't see anything wrong with just calculating the sine at each time sample (appropriately phase shifted) if you only have a couple of frequencies.

Thanks for the response. So you're saying to just literally write the reconstructed wave as I've been doing: ##\sum_i a_i\sin (f_i t)##, that this is the most robust way (ignoring phase) to reconstruct the signal?
 
  • #4
joshmccraney said:
Thanks for the response. So you're saying to just literally write the reconstructed wave as I've been doing: ##\sum_i a_i\sin (f_i t)##, that this is the most robust way (ignoring phase) to reconstruct the signal?

I still don't know what you mean by "robust" since you explicitly said "robust" means not doing that.

No, that would not be an accurate way to reconstruct the signal as it is missing the phase information. Also technically there should either be a ##2\pi## in the argument or you should use the angular frequencies ##\omega_i = 2\pi f_i##. The complete signal is represented either by ##\sum_i a_i\sin (\omega_i t + \phi_i)## or equivalently by ##\sum_i a_i\sin (\omega_i t) + \sum_i b_i\cos (\omega_i t)##.

If you ignore the phase then the signal you construct this way will have the same frequency content as the original, but it can't be said to be a "reconstruction" of the original signal since it's missing half the information. There are infinitely many different signals with the same frequency content.
 
  • #5
Thanks!
 

Similar threads

Replies
10
Views
2K
Replies
4
Views
2K
Replies
7
Views
4K
Replies
6
Views
4K
Replies
4
Views
3K
Replies
14
Views
25K
Replies
1
Views
990
Back
Top