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

  • Thread starter Thread starter member 428835
  • Start date Start date
  • Tags Tags
    Signal
AI Thread Summary
To reconstruct a signal using two frequencies, 50 Hz and 120 Hz, it is essential to include both amplitude and phase information. The discussion emphasizes that relying solely on sine and cosine functions without phase data will not accurately recreate the original signal. The inverse fast Fourier transform (IFFT) is recommended for converting the complex FFT back to the time domain. While calculating the sine at each time sample is feasible for a few frequencies, this method lacks robustness as it ignores phase information, which is crucial for accurate signal reconstruction. The correct approach involves using the complete representation that includes both sine and cosine components, ensuring that the phase is accounted for to avoid ambiguity in the reconstructed signal.
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
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.
 
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?
 
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.
 
Thanks!
 

Similar threads

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