Problem with fourier transform - frequency

5 visualizzazioni (ultimi 30 giorni)
M Convery
M Convery il 24 Gen 2017
Commentato: Star Strider il 24 Gen 2017
I have the following code in which I'm trying to find the peak frequency of some raw data yR (a vector). (Each value in this vector was measured in stages of 10.24s.) This is part of a lab and we have been told that the frequency should be around the test_freq given below. However, the plot of the Fourier transform is peaking at the origin and has a lot of "noise". What am I doing wrong?
yR = Re69;
L=length(yR); %number of readings
t_int = 10.24; %time interval, in seconds
time = linspace(0, (t_int*L), L); %time axis
test_freq = 29.9396258; % in hertz
overSampRate=10; %oversampling rate
fs=overSampRate*test_freq; %sampling frequency
YR = fft(yR);
mR = abs(YR);
angR = angle(YR);
f = (0:L-1)*test_freq/L;
plot(f,mR);

Risposte (1)

Star Strider
Star Strider il 24 Gen 2017
If it’s peaking at the origin, you have a d-c (direct current) or constant offset. The easiest way to eliminate it is to subtract the mean of your signal before calculating the fft:
YR = fft(yR-mean(yR))/length(yR);
You might want to review the documentation for the fft (link) function, since I suspect you’re not getting the results you’re expecting.
  2 Commenti
M Convery
M Convery il 24 Gen 2017
I'm still getting a peak at the origin :/
Star Strider
Star Strider il 24 Gen 2017
If you removed the d-c offset, the peak is not at the origin, but represents low-frequency baseline wander. You need to design a bandpass filter to get rid of the low-frequency baseline variation and any high-frequency noise that may exist.

Accedi per commentare.

Community Treasure Hunt

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

Start Hunting!

Translated by