0
votes

I have a relatively clean sine signal (from thin-film interference) - two data vectors:X-axis (difference in optical path length) and Y-axis (illuminate). I want to find the sine's frequency using Fourier transform (in matlab). How do I do that?

thanks!

1
I suggest that you read this article and look at these examples from The MathWorks, as well as the documentation for fft. Then you might look at this StackOverflow question: Understanding Matlab FFT example.horchler

1 Answers

-1
votes

Firts do you need to use one Window (hamming, hann) in your Signal and now all that you need is get the maximun value from first half Magnitude squared DATA, to find the Frequency calculate "sample rate * maximun index / length DATA:

t  = [ 0 : 1 : 100000];          
f  = 200;        % F0 here           
Fs = 44100;                    
data = sin(2*pi*f/Fs*t)';  
data = data .* hanning(length(data));    
Y = fft(data);    
Mag=abs(Y(1:length(data)/2)).^2;    
[a,b]=max(Mag);    
% Result    
Fs*b/length(data)