MATLAB Answers

fft of a finite duration real signal

10 views (last 30 days)
vsee
vsee on 20 Apr 2011
Hello
I have signal which is finite in duration sampled at a certain frequency and has a lot of noise buried in the signal. I am trying to plot the spectrum using fft to find out what frequency the signal is in. I don't know if I am doing the fft right. The plot of time vs amplitude and spectrum is in the link below.
Can anyone please help? Thanks

Answers (1)

Walter Roberson
Walter Roberson on 20 Apr 2011
What was the sampling frequency? It is difficult to make out on the graph but it appears you might have had 4 seconds of data at 30 kHz ?
Your frequency data is packed pretty tightly; you might want to zoom in on it. The interesting parts might be below 1 kHz or so.
  1 Comment
vsee
vsee on 20 Apr 2011
There is a sample every 400ns which converts to a sampling frequency of 2.5MHz. Here is the code I used.
sig = csvread('tek0001CH1.csv',15);
init_ampl = sig(:, 2);
ampl = init_ampl';
fs = 2.5*10^6;
T = 1/fs;
L = 10000000;
t = [0:L-1]*T;
NFFT = 2^nextpow2(L);
Y = fft(ampl,NFFT/4+1)/L;
f = fs/2*linspace(0,1,NFFT/4+1);
subplot(2,1,1),plot(t, ampl);xlabel('time');ylabel('amplitude');
subplot(2,1,2),plot(f,20*log10(abs(Y)));xlabel('frequency');ylabel('20*log10|Y|');
There are a total of 10 million samples.
You are right about the frequency data being packed tight. I just want to know where the signal is so I can filter out the noise.

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!

Translated by