how to find fft

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

Answers (1)

Star Strider
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
shilpa s on 18 Apr 2016
omg i cant see the file.plz can u provide that for me,,if u dont mind
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.
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
shilpa s on 19 Apr 2016
again i am stucked.my ultimate aim is to find the frequency at which peaks occurs in the IR spectrum of water.so i have two bondlengths say 'd1' and 'd2'.I have 7653 frames and time difference between adjacent frame is 30 atomic units (.726fs).when i do fft what should be the value of sampling frequency and after all i dont have any wave function.What i have is some discrete values say .9965,1.006 etc...how can i sort the frequencies using fft
Star Strider
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
shilpa s on 20 Apr 2016
Edited: Walter Roberson on 20 Apr 2016
my code is as follows
T=0.075*10^-15;
Fs=1/T;
x=fblAvgs+sblAvgs %first bond length averages+second bond length %averages
L=length(x);
Y=fft(x);
w=Y.*conj(Y)/L;
f=Fs/L*w(0:L/2);
plot(f,w(1:L/2+1))
xlabel(frequency)
ylabel(magnitude)
but i am not getting the desired values. please help me in finding the error related to my code

Sign in to comment.

Categories

Tags

No tags entered yet.

Asked:

on 18 Apr 2016

Edited:

on 20 Apr 2016

Community Treasure Hunt

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

Start Hunting!