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

10 次查看(过去 30 天)
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.
  2 个评论
vsee
vsee 2011-4-7
Hello
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 2011-3-17
csvread(), trapz(), fft()
  1 个评论
Florentino Ruiz
Florentino Ruiz 2011-3-17
Thank you for your answer, now i have idea for my proyect.
close all
clear all
clc
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(t,axmacovel(1:L))
% 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.
f=Fs/2*linspace(0,1,L/2);
figure (2)
% plot(f,2*abs(Y(1:NFFT/2))),
plot(f,0.707*abs(Y(1:L/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.

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Spectral Measurements 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by