Dear All

I am trying to analyse acceleration in the frequency domain. Here is my code to transfers time domain to frequency domain. I want the axis y in m/s2. Someone who can help me? Because now I am obtaining magnitude vs frequency (frequency domain). 

myData = xlsread('Book1.xls');

t = 0:0.01:19.99;

s=myData(:,1);

Ts=mean(diff(t));

fs=1/Ts;

L=length(s);

NFFT=2^nextpow2(L); 

M=L+1;

y=fft(s,NFFT);

mag=abs(y);

mag=mag*2/NFFT;

f=fs/2*linspace(0,1,NFFT/2+1);

figure;

plot(f(1:M/2),mag(1:M/2));

xlabel('Frequency (Hz)')

ylabel('Magnitude')

grid

Thanks

More Natividad Garcia Troncoso's questions See All
Similar questions and discussions