Find the frequency for signals by using FFT

8 visualizaciones (últimos 30 días)
Mohanned Al Gharawi
Mohanned Al Gharawi el 6 de Abr. de 2021
Comentada: Star Strider el 7 de Abr. de 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 comentarios
Mohanned Al Gharawi
Mohanned Al Gharawi el 7 de Abr. de 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 el 7 de Abr. de 2021
I got zero value for the frequency!!!

Iniciar sesión para comentar.

Respuesta aceptada

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

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Spectral Measurements en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by