MATLAB: Fourier transformation input parameters

fourier transformationinput parameters

Hello,
I have a question about the Fourier transformation.
I have a matrix 290×2. The first column is time values ​​in seconds. The second column are amplitudes in V.
Do I apply the Fourier transformation to the first + second column (data(:,1) + data(:,2)) or only to the second column (data(:,2)) or data(:,1:2)?
greetings
Christin

Best Answer

Only take the Fourier transform of the second column. Having the first column is necessary in order to calculate the frequency vector.
Example:
data = sortrows(rand(290,2)); % Create ‘data’ (Use Your Own Data)
L = size(data,1); % Matrix Length
Ts = mean(diff(data(:,1))); % Sampling Interval (Assumes Regular Sampling Interval)
Fs = 1/Ts; % Sampling Frequency
Fn = Fs/2; % Nyquist Frequency
FTdata = fft(data(:,2))/L; % Fourier Transform
Fv = linspace(0, 1, fix(L/2)+1)*Fn; % Frequency Vector (For One-Sided Spectrum)
Iv = 1:numel(Fv); % Index Vector (For One-Sided Spectrum)
figure
plot(Fv, abs(FTdata(Iv))*2)
grid
That should work with your data, although you may first need to subtract the mean from ‘data(:,2)’ if you have a large d-c (constant) offset that obscures the other peaks.