FFT manual help formulation
조회 수: 6 (최근 30일)
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
Matz Johansson Bergström 2015년 1월 22일
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.