Why I could not convert time domain to frequency domain data?
1 回表示 (過去 30 日間)
古いコメントを表示
Hi all; i try tho covert the time domain to frequency domain by using fft function, but the acceleration vs Frequency plot is incorrect. So kindly can anyone explain what is the wrong in the code. Thanks in advance
Lenght = size(x_time,2);
NFFT = 2^nextpow2(Lenght(1,1)-1); % Next power of 2 from length of b
Y1 = fft(Acc1,NFFT)/(Lenght(1,1)-1);
f = Fs/2*linspace(0,1,NFFT/2+1);
yPower1 = 2*abs(Y1(1:NFFT/2+1)); %magnitude
ydB1 = 20*log10(abs(Y1(1:NFFT/2+1))); %power
figure(51);
plot(f,yPower1);
xlabel('Frequency (Hz)','fontsize',14)
ylabel('Acc.','fontsize',14)
%axis ([0 10 0 10])
figure(61);
plot(f,ydB1);
xlabel('Frequency (Hz)','fontsize',14)
ylabel('Power (dB)','fontsize',14)
where x_time is the time vector Acc1 is the acceleration vector
4 件のコメント
Star Strider
2017 年 3 月 15 日
That looks correct to me.
The details will be more apparent if you add this line after each plot:
set(gca, 'XLim',[0 30])
since there doesn’t appear to be anything above 30 Hz.
回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Fourier Analysis and Filtering についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!