필터 지우기
필터 지우기

Find the frequency for signals by using FFT

조회 수: 4 (최근 30일)
Mohanned Al Gharawi
Mohanned Al Gharawi 2021년 4월 6일
댓글: Star Strider 2021년 4월 7일
Hello every body,
Thank in advance. I have several signals. They have been created by using a collections of images for one week. Anyhow, the siganls are available in the attached excel sheet. The interval time between each reading is 1-minute. My question is how we could the FFT to calculate the domenant frequecny (or the frequency) for each signal.
Thank you again.
  댓글 수: 3
Mohanned Al Gharawi
Mohanned Al Gharawi 2021년 4월 7일
Thank you for your answer, but I got confused!!!
That's my code:
s=data;
t = 1:length(s);
Ts = 1/(1*60); % Sampling Frequency in Hz
Fs = 1/Ts ; % Sampling Frequency
Fn = Fs/2; % Nyquist Frequency
L = length(s);
fts = fft(s)/L; % Normalised Fourier Transform
Fv = linspace(0, 1, fix(L/2)+1)*Fn; % Frequency Vector
Iv = 1:length(Fv); % Index Vector
amp = abs(fts(Iv))*2; % Spectrum Amplitude
phs = unwrap(angle(fts(
Mohanned Al Gharawi
Mohanned Al Gharawi 2021년 4월 7일
I got zero value for the frequency!!!

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

채택된 답변

Star Strider
Star Strider 2021년 4월 7일
One approach (I recognise my code from some previous Answer, so I’ll supply the rest of it):
T1 = readtable('signals.xlsx', 'VariableNamingRule','preserve');
t = T1.('time (minutes)');
L = numel(t);
s = T1{:,2:9};
Ts = mean(diff(t))*60; % Sampling Interval in Seconds
Fs = 1/Ts; % Sampling Frequency in Hz
Fn = Fs/2; % Nyquist Frequency
s_mean = mean(s);
fts = fft(s - s_mean)/L; % Normalised Fourier Transform
Fv = linspace(0, 1, fix(L/2)+1)*Fn; % Frequency Vector
Iv = 1:length(Fv); % Index Vector
amp = abs(fts(Iv))*2; % Spectrum Amplitude
phs = unwrap(angle(fts)); % Spectrum Phase
figure
subplot(2,1,1)
plot(Fv, abs(fts(Iv,:))*2)
xlim([0 2]*1E-4)
grid
subplot(2,1,2)
plot(Fv, phs(Iv,:))
xlim([0 2]*1E-4)
grid
I subtracted the mean (d-c- offset) to make the other peaks more visible.
The frequencies all appear to be the same. I leave the analysis of the individual signals to you.
  댓글 수: 2
Mohanned Al Gharawi
Mohanned Al Gharawi 2021년 4월 7일
It worked, I really appreciate your help. Thank you Star Strider!!
Star Strider
Star Strider 2021년 4월 7일
As always, my pleasure!

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

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