I need to find the FFT plot of my excel data.

조회 수: 1 (최근 30일)
Emimal M
Emimal M 2022년 2월 5일
댓글: Emimal M 2022년 3월 3일
Hi, am trying to get the FFT plot of my EMG data. Upon running the code am getting the numerical output of FFT but not getting the plot which I need and hereby attaching the code which I used. The file also I attach. Plz help me to get the plot.
clc
clear all
load Target1.mat
Error using load
Unable to find file or directory 'Target1.mat'.
x = Target1.X;
Y = Target1.Tr;
plot(x,Y)
z = fft(x)
Fs = 1000; % Sampling frequency
T = 1/Fs; % Sampling period
L = 1000; % Length of signal
t = (0:L-1)*T; % Time vector
f = Fs*(0:(L/2))/L;
plot(z,f)
title('FFT of an EMG signal')
xlabel('f (Hz)')
ylabel('|Z(f)|')

채택된 답변

KSSV
KSSV 2022년 2월 5일
Replace this line:
load Target1.mat
by
Target1 = readtable('Target1.xlsx') ;
  댓글 수: 1
Emimal M
Emimal M 2022년 3월 3일
Thank you so much for your answer... Got the expected output...

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

추가 답변 (1개)

Walter Roberson
Walter Roberson 2022년 2월 5일
Change
plot(z,f)
to
Z = z(1:length(f));
plot(f, real(Z), f, imag(Z))
legend({'real', 'imaginary'})
  댓글 수: 1
Emimal M
Emimal M 2022년 3월 3일
Thank you...I replaced the line and got my problem solved.....

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

카테고리

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