Subversion Repositories Projects

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
588 fredericg 1
 
2
function VibTestSpec(file)
3
 
4
% Read logfile
5
log=csvread(file);
6
fs=11111; % Sample freq
7
 
8
 
9
for col=1:10
10
    % Take one of the measurements
11
    inSignal=log(:,col)';
12
    inSignal = inSignal - mean(inSignal);
13
    n=length(inSignal);
14
 
15
    % Take FFT
16
    FFT = fft(inSignal);
17
    %spec = FFT.*conj(FFT)/n
18
    spec = abs(FFT)/n;
19
    spec = spec(1:n/2);
20
 
21
    specs(:,col) = spec;
22
end
23
 
24
f = int32(fs/n*(0:n/2-1)); % Freq
25
 
26
plot(f,specs);
27
title('Spectrum');
28
xlabel('Hz');
29
axis([1 400 0 15])