Borrar filtros
Borrar filtros

Why is my FFT having many but same peaks?

3 visualizaciones (últimos 30 días)
Hafiz Ahmad
Hafiz Ahmad el 28 de Mzo. de 2018
Respondida: Walter Roberson el 28 de Mzo. de 2018
I have a signal that I need to analyze and determine the noise. The signal is a collection of 4007 data. I extracted 1 out of the 4007 data and obtained this result:
This is how the FFT looks like with just 1 point of the data. This is the code that I used:
signal = importdata('ascan.txt');
Fs = 3490;
Fn = Fs/2;
L = length(signal); % Signal Length
FTsignal = fft(signal)/L; % Fourier Transform
Fv = linspace(0, 1, fix(L/2)+1)*Fn; % Frequency Vector
Iv = 1:numel(Fv); % Index Vector
figure(2)
plot(Fv, abs(FTsignal(Iv))*2)
grid
xlabel('frequency (Hz)');
ylabel('magnitude');
title('FFT of Signal');
I used the Nyquist frequency as I expected the symmetrical shape of the result. However when I input the whole signal into the FFT, I got this 2 result:
This is using Nyquist frequency, Fn.
As you can see, the number of peaks are the same, and they are the same. I am puzzled as I thought the shape should be symmetrical however, I attained this weird result. Do you know why this is the case?
The sampling frequency is 3490Hz and for this single I used this code:
signal = importdata('charlie.txt');
Fs = 3490;
Fn = Fs/2;
L = length(signal); % Signal Length
FTsignal = fft(signal)/L; % Fourier Transform
Fv = linspace(0, 1, fix(L/2)+1)*Fn; % Frequency Vector
Iv = 1:numel(Fv); % Index Vector
figure(2)
plot(Fv, abs(FTsignal(Iv))*2)
grid
xlabel('frequency (Hz)');
ylabel('magnitude');
title('FFT of Signal');
Can anyone point where I went wrong? Thank you for the clarification!
  2 comentarios
Walter Roberson
Walter Roberson el 28 de Mzo. de 2018
Could you attach a sample signal for testing?
Hafiz Ahmad
Hafiz Ahmad el 28 de Mzo. de 2018
Editada: Hafiz Ahmad el 28 de Mzo. de 2018

Iniciar sesión para comentar.

Respuesta aceptada

Walter Roberson
Walter Roberson el 28 de Mzo. de 2018
The data file you provided is 349 x 4007. You indicate that this is a collection of 4007 signals, so each individual signal is 349 x 1 and each column is a different signal. However, you are using length() of the entire array, and length() returns the largest dimension, so length() is 4007 rather than 349.
You are doing the fft of all of the data at the same time, getting a 349 x 4007 array.
You then index that array with a single index, Iv. That invokes linear indexing, so even though Iv is larger than 349, it just goes ahead and pulls data from multiple columns.

Más respuestas (0)

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by