필터 지우기
필터 지우기

Why I could not convert time domain to frequency domain data?

조회 수: 1 (최근 30일)
Muna Shehan
Muna Shehan 2017년 3월 15일
댓글: Muna Shehan 2017년 3월 16일
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
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.
Muna Shehan
Muna Shehan 2017년 3월 16일
Thanks for your comment.Based on your comment, the code for fft is correct even if the acceleration vs time profile is repeated sine wave signal as shown in the first plot .I followed your suggestion and the frequency response is as in the below plots.

댓글을 달려면 로그인하십시오.

답변 (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