FFT

4 views (last 30 days)
Okan
Okan on 21 Jun 2012
Hi,
I am trying to perform FFT for ambient vibration data and My code calculates such an absurd value like 6.2172e-17 for the first value of Fourier Amplitude Matrix. However, other amplitudes are reasonable and if I plot these amplitudes in loglog figure, I get meaningless plot.
for j=1:3
a{j}=textread(names{j},'%f');
a{j}=detrend(a{j},'constant');
a{j}=detrend(a{j});
if ((60*60)/length(a{j}))==0.02
A{j}=fft(a{j},2^nextpow2(length(a{j})));
A1{j}=abs(A{j}(1:2^nextpow2(length(a{j}))/2))*0.02;
%A1{j}(1)=A1{j}(2);
Fs=50;
f=Fs*(1:2^nextpow2(length(a{j}))/2)/(2^nextpow2(length(a{j})));
figure (j)
loglog(f,A1{j},'b');
title(names1{j});
xlabel('Frequency (Hz)');
ylabel('Fourier Amplitude');
elseif ((60*60)/length(a{j}))==0.01
A{j}=fft(a{j},2^nextpow2(length(a{j})));
A1{j}=abs(A{j}(1:2^nextpow2(length(a{j}))/2))*0.01;
%A1{j}(1)=A1{j}(2);
Fs=100;
f=Fs*(1:2^nextpow2(length(a{j}))/2)/(2^nextpow2(length(a{j})));
figure(j)
loglog(f,A1{j},'b');
title(names1{j});
xlabel('Frequency (Hz)');
ylabel('Fourier Amplitude');
end
end
The cell array are assigned in order to perform 40 FFT calculations for 40 different data texts. What makes Matlab calculate such an absurd value?

Answers (1)

Dr. Seis
Dr. Seis on 21 Jun 2012
Your first amplitude represents 0 frequency. When your data has 0 mean, your first amplitude should also be 0.

Categories

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

Tags

Community Treasure Hunt

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

Start Hunting!