FFT manual help formulation

6 views (last 30 days)
nur yusof
nur yusof on 22 Jan 2015
Commented: nur yusof on 27 Jan 2015
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

Answers (1)

Matz Johansson Bergström
Matz Johansson Bergström on 22 Jan 2015
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 Comment
nur yusof
nur yusof on 27 Jan 2015
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?

Sign in to comment.

Categories

Find more on Fourier Analysis and Filtering in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!