High resolution FFT from time domain data.
5 views (last 30 days)
I have a very large time domain data with a lot of samples, but still I am not getting a good resolution in the FFT spectrum. Is that because I have to change the value of Fs (in the code below)? I have also attached the data file, code and the plot.
Download the 25 MB data file from here: (It is already in .mat format for your convenience).
I get all the points in the FFT spectrum spaced with 50 Hz spacing. But I need a god resolution. Because the resolution is not good, hence the information and other linked parts of my code are not functioning correctly.
Please let me know what can be done about this. Thanks in advance.
fft_columns = ;
for i = 2:1:size(data,2)
X = data;
xdft = fft(X(:,i));
DT = X(2,1)-X(1,1);
% sampling frequency
Fs = 1/DT;
DF = Fs/size(X,1);
freq = 0:DF:Fs/2;
N = length(X);
xdft = xdft(1:length(xdft)/2+1)';
Xmag = abs(xdft); % Spectral magnitude
Xdb = 20*log10(Xmag);
Xdb(1,1) = Xdb(1,2);
XdbMax = max(Xdb); % Peak dB magnitude
Xdbn = Xdb - XdbMax;
%Xdbn = Xdb - 0;
dBmin = -120; % Don't show anything lower than this
Xdbp = max(Xdbn,dBmin); % Normalized, clipped, dB mag spec
fft_columns = [fft_columns; Xdbp];
%dB = mag2db(abs(xdft))
% psdx = (1/(Fs*N)) * abs(xdft).^2;
% psdx(2:end-1) = 2*psdx(2:end-1);
figure('Position', [1 1 4000 700])
axis([0 5000 -79 2])