필터 지우기
필터 지우기

FFT of signal from text file

조회 수: 19 (최근 30일)
John Smith
John Smith 2015년 11월 19일
댓글: krn99 2017년 6월 5일
Hi, I am trying to plot an FFT for an EMG signal which is saved in a text file. I did manage to plot the actual signal, but when I plotted the FFT, the window remained blank. Can someone please highlight what I am doing wrong. Also, How to determine the sampling frequency value (Fs)?
Attached please find the text file containing the EMG signal data. Thanks in advance.
Ts = mean(diff(t)); % Sampling Time
Fs = 1/Ts; % Sampling Frequency
Fn = Fs/2; % Nyquist Frequency
FEMG = fft(EMG)*2/L; % Fourier Transform (Normalised)
Fv = linspace(0, 1, fix(L/2)+1)*Fn; % Frequency Vector
Iv = 1:length(Fv); % Index Vector
figure(1)
plot(Fv, abs(FEMG(Iv)))
grid

채택된 답변

Star Strider
Star Strider 2015년 11월 20일
I don’t see the error in your code, but the code here I wrote (plotting half of the fft) works:
fidi = fopen('John Smith emg.txt', 'rt');
T_EMG = textscan(fidi, '%f%f', 'Delimiter',' ');
t = T_EMG{1};
EMG = T_EMG{2};
L = length(t);
Ts = mean(diff(t)); % Sampling Time
Fs = 1/Ts; % Sampling Frequency
Fn = Fs/2; % Nyquist Frequency
FEMG = fft(EMG)*2/L; % Fourier Transform (Normalised)
Fv = linspace(0, 1, fix(L/2)+1)*Fn; % Frequency Vector
Iv = 1:length(Fv); % Index Vector
figure(1)
plot(Fv, abs(FEMG(Iv)))
grid
  댓글 수: 7
Star Strider
Star Strider 2017년 5월 28일
My pleasure.
krn99
krn99 2017년 6월 5일
sir i have used 10hz cutt of freq(fc) high pass and 1000hz fc for low pass FIR filter(4th order). i have used filtfilt function to avoid zero lag. But my doubt is do i want to do divide my cut off frequency with 0.802 for fourth order which is mentioned in Winters and Robertson book. i dont understand their concept. if you know please tell me. Thanks in advance

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

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