Unexpected peaks of the FFT sparse resolution signal (OCTAVE or MATLAB)

Suppose that the signal corresponds to daily values ​​during the year (365 days). It consists of all zeros, with the exception of several sparse values ​​that correspond to isolated peaks divided by the same interval (30 days). I get a frequency spectrum with a fast Fourier transform function.

  • How to get rid of a peak with a high 0 Hz? EDIT : this is due to a non-zero signal value. See this post for more details.

  • The first peak is then at 12 Hz, which is somehow expected. However, peaks are also present at 24 Hz, 36 Hz, 48 Hz .... Is this a smoothing problem? How to get rid of it?

Below is my code. It has been tested in Octave, but it should also work in Matlab

close all clear all T = 1/365; % period samp_freq = 1/T; % sample frequency t=0:T:2; % overall time span is two years % build signal x= zeros(length(t),1); for i=1:length(t) if mod(i,30) == 0 x(i) = 100; else x(i) = 0; end end figure(1) plot(t,x) grid xlabel("Time [years]") ylabel("Signal amplitude") y=fft(x); N = length(x); for i=1:N f(i) = (i-1)*samp_freq/N; end figure(2) plot(f,abs(y)) xlabel("Frequency") ylabel("Signal amplitude") figure(3) plot(f(1:80),abs(y(1:80))) xlabel("Frequency") ylabel("Signal amplitude") 

Signal and frequency spectrum

Frequency spectrum zoom

+5
source share
2 answers

The peak at 0 Hz is the "DC component" of your signal, which is the same as the arithmetic mean. You could subtract the average from your dataset to get rid of it or just ignore it.

Other peaks with a multiple of 12 Hz are called "harmonics" - they exist because your periodic signal is not sinusoidal (it is actually a pulse). The first peak at 12 Hz is called "basic" . You can either pre-filter your signal to remove harmonics, or simply ignore everything higher, say, 20 Hz).

You can also consider applying a function to your data to reduce spectral leakage and thereby make your peaks sharper and more accurate.

+3
source

Your results are completely correct.

Your input signal is basically a dirac comb with a period of T 30 / (365 * 2): 100 III_ {30 / (365 * 2)}.

the exact Fourier transform of this signal is again the crest of the dirac: 100 * (365 * 2) / 30 III _ {(365 * 2) / 30} = 24333 III _ {(365 * 2) / 30}. This is almost the result you get.

If you want to find the period of your input signal, find the first peak after 0 Hz.

+2
source

Source: https://habr.com/ru/post/1265081/


All Articles