Afficher commentaires plus anciens
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?
Réponses (1)
Dr. Seis
le 21 Juin 2012
0 votes
Your first amplitude represents 0 frequency. When your data has 0 mean, your first amplitude should also be 0.
Catégories
En savoir plus sur Fourier Analysis and Filtering dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!