Borrar filtros
Borrar filtros

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

1 visualización (últimos 30 días)
Muna Shehan
Muna Shehan el 15 de Mzo. de 2017
Comentada: Muna Shehan el 16 de Mzo. de 2017
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 comentarios
Star Strider
Star Strider el 15 de Mzo. de 2017
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 el 16 de Mzo. de 2017
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.

Iniciar sesión para comentar.

Respuestas (0)

Categorías

Más información sobre Fourier Analysis and Filtering en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by