Extracting certain frequencies from FFT results using a window function

7 Ansichten (letzte 30 Tage)
KC
KC am 24 Jan. 2024
Kommentiert: Star Strider am 8 Feb. 2024
I am trying to come up with a code to extract certain frequencies from the fft result. I have 1 Hz data (259200 seconds for three days) and would like to convert the time series information into the frequency domain. The window size I would like to use is 2048 and the window function is hamming. The analysis window is shifted without any overlapping. The data at the frequency around 0.03 Hz is picked up from the FFT result and plotted against the time series data (x-axis) of 3 days (259200 seconds).
I know how to apply the window function on the whole length of the data but just not when you you have something like 2048 which is shorter than the length of the signal. I thought of using a loop function? Or probably buffer? Is this the right direction?
Also, I have no idea how to pick up the data from the fft results based on the frequency. How do I know the frequnecy I want (0.03 Hz) is in which bin? Meaning, if the frequency I want is within a bin then I would like the whole bin.

Antworten (1)

Star Strider
Star Strider am 24 Jan. 2024
Frequency dokmain filtering is possible, however not ideal.
If you want to do that, the fftfilt function is the best option. It requires designing a FIR filter first, however that is relativelystraightforward using designfilt.
  12 Kommentare
KC
KC am 8 Feb. 2024
@Star Strider thanks for the above. I just have a couple of more questions.
Firstly, is there a typo in the last part of your code above? More specifically, ' y2_filt - filtfilt(df, y2)'? If there isn't any mistake please could you elaborate more on the code.
Secondly, is there anyway we can control the window size in the fft frequency domain? I read there are a couple of ways to do that by multiplying the original signal to the hamming function? Is there a way to do this? I think maybe controlling the window size just may remove the NaN values after the doing the fft.
Thank you again for all your help. Much apprericated.
Star Strider
Star Strider am 8 Feb. 2024
My pleasure.
The negative should be a n equal sign:
y2_filt = filtfilt(df, y2);
Windowing a Fourier transform corrects for the numeric Fourier transform being finite in length, as opposed to its actually being calculated over . The chosen window size (length) is the size (length) of the original time-domain vector.
The window function has no effect on the NaN values if they are in the data or if they are the result of filter instablility. It will not correct for them or eliminiate them.

Melden Sie sich an, um zu kommentieren.

Produkte


Version

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by