Borrar filtros
Borrar filtros

High resolution FFT from time domain data.

5 visualizaciones (últimos 30 días)
Jay Vaidya
Jay Vaidya el 19 de Dic. de 2020
Comentada: Jay Vaidya el 19 de Dic. de 2020
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.
Code:
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];
end
%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])
%figure
plot(freq,fft_columns(1,:),'color', [1,0.55,0],'LineWidth',7);
axis([0 5000 -79 2])
Plot:

Respuestas (1)

Matt Gaidica
Matt Gaidica el 19 de Dic. de 2020
How big is data? You can zero-pad your FFT, or add more to 'data', that might help you.

Categorías

Más información sobre Parametric Spectral Estimation en Help Center y File Exchange.

Etiquetas

Productos


Versión

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by