FFT

1 回表示 (過去 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 Center および File ExchangeFourier Analysis and Filtering についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by