FFT

2 次查看(过去 30 天)
Okan
Okan 2012-6-21
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?

回答(1 个)

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

类别

Help CenterFile Exchange 中查找有关 Fourier Analysis and Filtering 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by