fast fourier transform functions function

I have a question about fft function. I have a set of data consisting of two columns; one is time in seconds, and the other is amplitude. now I need to find the seven dominant frequencies buried in the noisy time signal, and also I know that very low frequencies (less than 0.01Hz) can spoof my low-frequency output unless I subtract the mean of the data from the time series before taking the Fourier transform. I need a hint to start writing the code for this, I read the Matlab help page, but it confused me more. any help that can explain this more to me will be appreciated, Thank you

 採用された回答

Image Analyst
Image Analyst 2012 年 10 月 7 日

0 投票

Can't you just FFT the signal, then call sort() and take the 7 frequencies with the largest signal?
By the way, how did you get your noisy signal? Could a Lock-in Amplifier help improve your signal?

3 件のコメント

Salar
Salar 2012 年 10 月 7 日
clc
t=data(:,1);
A=data(:,2);
f=100
T=1/f
N = 10000; %%number of points
f = sin(2*pi*10*T); %%define function, 10 Hz sine wave
p = abs(fft(f))/(N/2); %%absolute value of the fft
p = p(1:N/2).^2 %%take the power of positve freq. half
freq = [0:N/2-1]/T; %%find the corresponding frequency in Hz
%semilogy(freq,p); %%plot on semilog scale
Salar
Salar 2012 年 10 月 7 日
I get error for this code, and it's not working,
Image Analyst
Image Analyst 2012 年 10 月 7 日
編集済み: Image Analyst 2012 年 10 月 7 日
Well, you define f, but then redefine it. Was the output of the sin() function supposed to be "data" instead of f? Secondly, you don't use A and t. Thirdly, your signal is just one frequency, not lots of them plus noise. Fourth, you define freq, which has nothing to do with anything. Basically this program is a mess. Try again. Next time start with data, then fft the data, then take the real part or magnitude and sort it. Then take the 7 highest components.

サインインしてコメントする。

その他の回答 (0 件)

Community Treasure Hunt

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

Start Hunting!

Translated by