Problem with fourier transform - frequency

5 次查看(过去 30 天)
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);

回答(1 个)

Star Strider
Star Strider 2017-1-24
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 个评论
M Convery
M Convery 2017-1-24
I'm still getting a peak at the origin :/
Star Strider
Star Strider 2017-1-24
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.

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Frequency Transformations 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by