# MATLAB: FFT conversion of sound pressure in the time domain.

fft simple array

Hi, I have 500k lines of data. One column is time the other sound pressure. I want to run an FFT to get into frequency domain but I'm finding this hard. Then I want convert this to dB and then I'll A-weight this output. Most important is the FFT first. Around 6 seconds of data sampled at 50K Hz. rapidly loosing the will to live. Cheers R

(Import data using ‘audioread’, ‘load’, or whatever is appropriate for your file)t = ...;                                                        % Time Vectors - ...;                                                        % Signal VectorL = length(s);                                                  % Signal Length (Obviously)Ts = mean(diff(t));                                             % Sampling IntervalFs = 1/Ts;                                                      % Sampling FrequencyFn = Fs/2;                                                      % Nyquist Frequencyfts = fft(s)/L;                                                 % Fourier TransformFv = linspace(0, 1, fix(L/2)+1)*Fn;                             % Frequency VectorIv = 1:length(Fv);                                              % Index Vectorfigure(1)subplot(2,1,1)plot(Fv, abs(fts(Iv))*2)gridtitle('Fourier Transform of ‘s’')ylabel('Amplitude')subplot(2,1,2)plot(Fv, angle(fts(Iv)))gridylabel(Phase (rad)')xlabel('Frequency (Hz)')
dB = @(amplitude) 20*log10(abs(amplitude));
s_dB = dB(fts);