Pregunta

So first I was getting myself used to Matlab FFT, for example I would do the following:

    clc     
    fs = 4;    
    t = 0:1/fs:1-1/fs;     
    x1 = sin((2*pi)*t);     
    y1 = fft(x1,n);    

   FT_power1 = abs(y1(1:floor(n/2))).^2;     
   FT_phase1= (((angle(y1(1:floor(n/2))))) * 180/pi);     
   [c1,i1] = max(FT_power1);     
   phase(1) = FT_phase1(i1);

And I think I have a decent understanding of why use Nyquist and sampling frequency parameter. However now, I am suppose to do the same procedure on an array of output (that is sinusoidal coming from a different subroutine I have), which means my output array has 2 columns, the first is for the time vector and the second is the actual sinusoidal response. Now, how to incorporate the fs parameter? I am confused all the sudden. Please let me know if you need more details. Thank you.

¿Fue útil?

Solución

If I understand your question correctly, your new array is actually a 2-dimensional array, with the first dimension representing the time a sample was taken, and the second dimension representing the samples of a sinusoidal.

To process your new array via the FFT, simply ignore the time dimension, and use only the samples dimension (the sinusoidal data samples).

The Nyquist rate still applies in this case. Your sinusoidal must be sampled at twice (or more) the maximum frequency that you hope to resolve via the FFT.

The FFT uses the sampling frequency to properly scale the frequency axis of the FFT output.

You can learn all about the Nyquist–Shannon sampling theorem here: Sampling theorem

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top