how to find fft
Show older comments
hai frnds,
i have 7653 values for bond length of OH bond in water during spectral analysis.so now the next step is to find the fft of the bond length.value of time varies as (0:.725:5548.425).please generate the code for me.I am stucked
1 Comment
Behind The Sciences
on 18 Apr 2016
Have a look to this post to understand what you want to do: http://www.behindthesciences.com/signal-processing/fouriertransformtheory
Then,have a look to this post to get code that you need: http://www.behindthesciences.com/signal-processing/fouriertransformmatlabtutorial
Answers (1)
Star Strider
on 18 Apr 2016
0 votes
See this documentation for the fft function. The code between the top two plot figures has everything you need to analyse and plot your Fourier transformed data.
6 Comments
shilpa s
on 18 Apr 2016
Image Analyst
on 18 Apr 2016
Please use English. Textspeak just slows us down when we try to read and understand what you're trying to say, not to mention that it is doubly hard to understand for non-native English speakers. Try this
theFFT = fft(bondLengths);
where bondLengths is your vector of 7653 values of bond lengths.
Star Strider
on 18 Apr 2016
I’ve used versions of this in my other Answers on the fft:
Fs = 1000; % Sampling frequency
T = 1/Fs; % Sample time
L = 1000; % 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)')
NFFT = 2^nextpow2(L); % Next power of 2 from length of y
Y = fft(y,NFFT)/L;
f = Fs/2*linspace(0,1,NFFT/2+1);
% Plot single-sided amplitude spectrum.
plot(f,2*abs(Y(1:NFFT/2+1)))
title('Single-Sided Amplitude Spectrum of y(t)')
xlabel('Frequency (Hz)')
ylabel('|Y(f)|')
The first block of code creates the signal (you don’t need that but it explains many of the constants used in the rest of the code), the second block of code calculates the Fourier transform, and the third block of code plots it. This is all directly from the documentation I linked to.
shilpa s
on 19 Apr 2016
Star Strider
on 19 Apr 2016
The frequencies sort themselves.
To find the peaks and the associated frequencies, use the findpeaks function on the absolute value of the fft, just as you plotted them here.
shilpa s
on 20 Apr 2016
Edited: Walter Roberson
on 20 Apr 2016
Categories
Find more on Vibration Analysis 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!