FFT manual help formulation

5 次查看(过去 30 天)
nur yusof
nur yusof 2015-1-22
评论: nur yusof 2015-1-27
Good day everyone!
I've been trying to introduce the fast fourier transform function fft into my code, to replace my manually coded fourier transform. The results I get are different and I have no idea why.
My coding is:-
Fs = 512; % Sampling frequency T = 1/Fs; % Sample time L = 6678; % Length of signal t = (0:L-1)*T; % Time vector Sum of a 50 Hz sinusoid and a 120 Hz sinusoid x = 0.7*sin(2*pi*50*t) + sin(2*pi*120*t); y = x + 2*randn(size(t)); % Sinusoids plus noise plot(Fs*t(1:50),y(1:50)) title('Signal Corrupted with Zero-Mean Random Noise') xlabel('time (milliseconds)')
Can somebody tell me why the coding from help plot only 1:50,what it means by 50?And also what sum of a 50Hz sinusoid and a 120 hz sinusoid means?Is it standard equation for all signal?
Thanks in advance

回答(1 个)

Matz Johansson Bergström
The range 1:50 is only used in the plot, not in the rest of the example. See Documentation on FFT I guess they chose 50 because they want to demonstrate that it is very difficult to see frequency information from a noisy signal, that's all.
When they get back the information they want, the frequencies 50 and 120, you have to use the full signal, as they did. They actually pad to the next "power of two"-size, to get a more efficient transform.
  1 个评论
nur yusof
nur yusof 2015-1-27
Then can I use the
x = 0.7*sin(2*pi*50*t) + sin(2*pi*120*t)
y = x + 2*randn(size(t))
equation in my calculation to get FFT value?

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Fourier Analysis and Filtering 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by