How to compute the fourier transform for a signal u(t) over frequency band [-10,10]?

I have a signal u(t) already defined, but I need to compute the fft and plot the magnitude and phase of the fourier transform. HOW DO I DO THIS?
I TRIED FFT(U,[-10,10]), BUT DOESN'T WORK.

回答 (3 件)

Dr. Seis
Dr. Seis 2012 年 1 月 14 日
Say you have the following:
N = 1024; % Number of samples
dt = 0.01; % Seconds per sample
u_time = randn(1,N);
Then, you would have:
Nyquist = 1/(2*dt);
df = 1 / (N*dt);
f = -Nyquist : df : Nyquist-df;
U_freq = fftshift(fft(u_time));
And you can plot this data between -10 and 10 Hertz by:
figure;
plot(f , abs(U_freq)*dt, 'b-'); hold on;
plot(f , angle(U_freq),'r-'); hold off;
xlim([-10 10]);
legend('magnitude','phase');
However, the above formulation assumes that your data are even. I would go further and try to pad your time data with zeros to next power of 2 (i.e., above is 2^10). Let me know if you have questions about doing that.
Walter Roberson
Walter Roberson 2012 年 1 月 13 日
freqs = fft(U);
plot(real(freqs),'b*-');
hold on
plot(imag(freqs),'r+:');

4 件のコメント

MINAS104
MINAS104 2012 年 1 月 14 日
what about the [-10,10] frequency band?
Walter Roberson
Walter Roberson 2012 年 1 月 14 日
What do negative frequencies mean?
MINAS104
MINAS104 2012 年 1 月 14 日
from -10Hz to 10Hz.
Could you also do this?
plot(angle(fft(u)) %phase
plot(abs(fft(u)) %magnitude
Walter Roberson
Walter Roberson 2012 年 1 月 16 日
So -10 Hz is a signal that goes backwards in time??

サインインしてコメントする。

Honglei Chen
Honglei Chen 2012 年 1 月 13 日
Depending on your sampling rate and the number of points in your signal, you may want to also explore the following function
doc goertzel
doc czt

質問済み:

2012 年 1 月 13 日

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by