FFT. It doesn't seem to find the frequencies

조회 수: 3 (최근 30일)
Maria Goncalves Møller
Maria Goncalves Møller 2018년 11월 15일
댓글: Maria Goncalves Møller 2018년 11월 15일
Hi, Im having a lot of issues turning my time domain into a frequency domain. What am I doing wrong? I expect some high frequency noise - also outside of 500 Hz, and the fft only shows frequencies around 0 Hz...
%% Load data
load('henrikrigtigforsoeg.mat')
data1 = data(1:20000)*0.0049;
fs = 1000; % Sampling frequency
time = 1/fs;
leng = 20000; %length of signal
t = (0:leng-1)*time % Time vector
%% Cut the data
kont_1 = data1(3000:7000); %Contraction 1
t_y1 = (0:4000)*time; %time vector for contraction 1
leng_k1 = length(kont_1); %length of the contraction
%% FFT
Y1 = fft(kont_1); % Lav en FFT på data
P2_y1 = abs(Y1/leng_k1);
P1_y1 = P2_y1(1:leng_k1/2+1);
P1_y1(2:end-1) = 2*P1_y1(2:end-1);
f_y1 = fs*(0:(leng_k1/2))/leng_k1;
%% Plot data
figure
subplot(2,1,1) % Plot the raw data
plot(t_y1,kont_1)
title('Contraction in time-domain')
xlabel('Time in seconds')
ylabel('Magnitude in V')
subplot(2,1,2) % Plot the Fourier transformation
plot(f_y1,P1_y1)
title('Single-sided power spectrum of first contraction')
xlabel('Frequencies in Hz')
ylabel('Power in V')
  댓글 수: 2
Adam
Adam 2018년 11월 15일
A high frequency component at 0 means your data is very badly zero-centred. If you subtract the mean from your data this should go away.
Maria Goncalves Møller
Maria Goncalves Møller 2018년 11월 15일
Like the following right?
data1 = (data(1:20000)*0.0049);
data2 = data1- mean(data1)
It still looks like this:
matwork.PNG

댓글을 달려면 로그인하십시오.

답변 (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