Problem with fourier transform - frequency

조회 수: 5 (최근 30일)
M Convery
M Convery 2017년 1월 24일
댓글: Star Strider 2017년 1월 24일
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