MATLAB Answers

How to calculate the spectrum of a signal in CSV file?

58 views (last 30 days)
I'm working on a project whose aim is to develop measurements of acceleration with an accelerometer, I have made ??measurements 10.24kS sampled, stored in CSV files, measurements were performed for two seconds, which means I have 20.48 kS. I need to convert the acceleration signal to a new speed signal using integration. Then I apply the FFT to acquire the spectrum of the speed signal with a Hanning or Hamming window. But I do not know how to do any of these steps. If anyone has any idea how to do it, I appreciate your help.


vsee on 7 Apr 2011
I have a similiar situation. I have a signal stored in a csv file. The sample interval is 2us which means a sample taken every 2 micro seconds. I have a million sampples in the file. Essentially the signal is in the time domain (x(t) vs t). I have to acquire the spectrum of the signal to analyze it. Can you please explain how to do this?
Walter Roberson
Walter Roberson on 7 Apr 2011
vsee, please start a new Question for your topic.

Sign in to comment.

Accepted Answer

Walter Roberson
Walter Roberson on 17 Mar 2011
csvread(), trapz(), fft()

  1 Comment

Florentino Ruiz
Florentino Ruiz on 17 Mar 2011
Thank you for your answer, now i have idea for my proyect.
close all
clear all
Fs = 10240; % Sampling frequency
T = 1/Fs; % Sample time
L = 20480; % Length of signal
t = (0:L-1)*T; % Time vector
load axmacovel
figure (1)
% plot(Fs*t(1:L),axmacovel(1:L))
title('Velocidad de vibración')
xlabel('Tiempo (s)'), ylabel('Velocidad mm/s RMS'), grid on
% NFFT=2^nextpow2(L); % Siguiente pot de 2 de la long de 'y'.
Y=fft(axmacovel); % Aplica Transformada de Fourier.
% f=Fs/2*linspace(0,1,NFFT/2); % Vector de frecuencias.
figure (2)
% plot(f,2*abs(Y(1:NFFT/2))),
title('Espector de la Señal'),
xlabel('Frecuencia (Hz)'), ylabel('Velocidad mm/s RMS'), grid on
axmacovel is on my workspace of matlab, this variable was adquired manually: File-Import Data, etc. This axmacovel signal is the integration of the original acceleration signal, but i will have this manually. I don´t know if i used fft function correctly, because the level of signal in espectrum are different as i have in a Labview program.

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!

Translated by