fft application for signal processing to know frequency
6 views (last 30 days)
Show older comments
I have some signal data as shown below. It is constructed with 624 sample points from text file. This signal generated from a 4MHz ultrasonic transducer. By applying FFT in Matlab, I want to know which frequency is dominating in the below signal.
For the above purpose I am able to read the data from text file and plot it as shown above. After that iam applying FFT by using abs(fft(‘textfile name’ , N)) Please suggest me where to define the frequency of signal in the code and what should be the N value in fft command line. With out giving N value and frequency parameters iam getting the following figure
How the X-axis values to be converted to frequency values, because the x-axis is showing only 624 values. Whether the above plot is correct or not. Please guide me
0 Comments
Answers (1)
Star Strider
on 24 Nov 2014
See the documentation for fft, specifically the section after the first figure that demonstrates how to calculate the frequency vector for your plot:
NFFT = 2^nextpow2(L); % Next power of 2 from length of y
Y = fft(y,NFFT)/L;
f = Fs/2*linspace(0,1,NFFT/2+1);
You need your sampling frequency (here ‘Fs’) to calculate the ‘f’ (frequency) vector.
4 Comments
Star Strider
on 12 Dec 2014
You say your data are generated by a ‘4MHz ultrasonic transducer’. I assume the carrier frequency is 4MHz. You have to look through the documentation for your transducer and probably the file itself to find out what the sampling frequency ‘Fs’ is. I cannot tell it from your data.
If you have a time vector for your 624 data points, what is the difference (in seconds) between the consecutive sampling points? That is your sampling interval or sampling time ‘Ts’, and you can calculate the rest from the code I posted in my [24 Nov 2014, 18:42] Comment.
‘L’ is the length of your data vector, so here:
L = 624;
See Also
Categories
Find more on Parametric Spectral Estimation in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!