Filter löschen
Filter löschen

Find the frequency for signals by using FFT

2 Ansichten (letzte 30 Tage)
Mohanned Al Gharawi
Mohanned Al Gharawi am 6 Apr. 2021
Kommentiert: Star Strider am 7 Apr. 2021
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 Kommentare
Mohanned Al Gharawi
Mohanned Al Gharawi am 7 Apr. 2021
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 am 7 Apr. 2021
I got zero value for the frequency!!!

Melden Sie sich an, um zu kommentieren.

Akzeptierte Antwort

Star Strider
Star Strider am 7 Apr. 2021
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 Kommentare
Mohanned Al Gharawi
Mohanned Al Gharawi am 7 Apr. 2021
It worked, I really appreciate your help. Thank you Star Strider!!
Star Strider
Star Strider am 7 Apr. 2021
As always, my pleasure!

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by