REPresent
Electrical
- Jul 12, 2013
- 2
Hello,
Im making research on humans gait and I found some troubles with matlab. I need given data in file pass through Fast fourier transformation. In given file taken column as X axe are samples of acceleration (which varies depending on movement). Frequence of device is 120Hz. In figure1 X axe is Time(s), Y axe is Acceleration(m/s^2) The main matter is how to make Spectrum of this Acceleration wave that in X axe would be Frequence and in Y axe would be Acceleration.
I inlcuded data text file named MTbeapsisukimo2:
Theres the code where I was trying to make X axe - as a frequence and Y axe as a Power:
accX=MTbeapsisukimo2,9); %X Acceleration
accX=single(accX); % One Array
Fs=120; % Sampling frequency
t=0:1/Fs:22.945; % Time vector of 22.945 seconds
x=accX;
nfft=2754; % Length of FFT
% Take fft, padding with zeros so that length(X)is equal to nfft
X=fft(x,nfft);
% Take the magnitude of fft of x
mx=abs(X);
% Frequency vector
f=(0:nfft-1)*Fs/nfft;
% Generate the plot, title and labels.
figure(1)
plot(t,x)
title('Acceleration Wave Signal');
xlabel('Time (s)');
ylabel('Acceleration');
figure(2)
plot(f,mx)
title('Power Spectrum of a Acceleration Wave');
xlabel('Frequency (Hz)');
ylabel('Power');
I would be very thankfull for any consultation
Im making research on humans gait and I found some troubles with matlab. I need given data in file pass through Fast fourier transformation. In given file taken column as X axe are samples of acceleration (which varies depending on movement). Frequence of device is 120Hz. In figure1 X axe is Time(s), Y axe is Acceleration(m/s^2) The main matter is how to make Spectrum of this Acceleration wave that in X axe would be Frequence and in Y axe would be Acceleration.
I inlcuded data text file named MTbeapsisukimo2:
Theres the code where I was trying to make X axe - as a frequence and Y axe as a Power:
accX=MTbeapsisukimo2,9); %X Acceleration
accX=single(accX); % One Array
Fs=120; % Sampling frequency
t=0:1/Fs:22.945; % Time vector of 22.945 seconds
x=accX;
nfft=2754; % Length of FFT
% Take fft, padding with zeros so that length(X)is equal to nfft
X=fft(x,nfft);
% Take the magnitude of fft of x
mx=abs(X);
% Frequency vector
f=(0:nfft-1)*Fs/nfft;
% Generate the plot, title and labels.
figure(1)
plot(t,x)
title('Acceleration Wave Signal');
xlabel('Time (s)');
ylabel('Acceleration');
figure(2)
plot(f,mx)
title('Power Spectrum of a Acceleration Wave');
xlabel('Frequency (Hz)');
ylabel('Power');
I would be very thankfull for any consultation