Prev: Full-BEKK MGARCH
Next: alligning columns in a file
From: thisisme on 17 Apr 2010 15:25 Hi, I have a time domain data file which is acquired by a 100MSample digitizer. The data file has 10000 samples of the data. I only want to see the spectral content of a part of the data. I have the following code. I will appreciate if someone tells me this is alright or am I missing out on something or doing something wrong.: clear all; Fs = 100000000; % Sampling frequency T = 1/Fs; % Sample time L = 4096; % Length of signal %t = (0:L-1)*T; % Time vector filenames = dir; load tdmfile; start_point = 1600; end_point = 5595; % start point and end point are taken so that they match the %value of L so that it doesn't pad zeros to the data % start_point =1650; % end_point = 2161; t = tdmfile(start_point:end_point, 1); x = tdmfile(start_point:end_point, 2); NFFT = 2^nextpow2(L); % Next power of 2 from length of y Y = fft(x,NFFT)/L; f = Fs/2*linspace(0,1,NFFT/2+1); % Plot single-sided amplitude spectrum. subplot(2,1,1) plot(t,x); grid on axis([min(t) max(t) min(x) max(x)]) title((filenames(i,1).name)); subplot(2,1,2) plot(f,2*abs(Y(1:NFFT/2+1))) %plot(f,20*log10(Y(1:NFFT/2+1))) grid on % saveas(figure(i),sprintf('img%03d',i),'jpg')
|
Pages: 1 Prev: Full-BEKK MGARCH Next: alligning columns in a file |