data_output is a 60000×2 matrix.
Concerning line the line that is highlighted with arrows, "fhat = fft(f,n);", I keep recieving "Error using fft
Invalid data type. First argument must be double, single, int8, uint8, int16, uint16, int32,uint32, or logical.".
What can I do to make the code function? Are either t or f that is the problem?
dt = .001;t = 0:dt:1;f = 'data_output(:1)';figure;plot(t,ffilt); ",dt = .001;%dt = 0.00001666667;
t = 0:dt:1;f = 'data_output(:1)';figure;plot(data_output)xlabel('time(s)');ylabel('Amplitude');grid on%% Compute the Fast Fourier Transform FFT
n = length(t); ----------------------------- >>>fhat = fft(f,n); <<< ------------------------PSD = fhat.*conj(fhat)/n; freq = 1/(dt*n)*(0:n); L = 1:floor(n/2); figure; dim = 2;plot(f,fhat,2); % FFT plot
xlim([0 1]);xlabel('Frequency(Hz)');ylabel('FFT Magnitude'); grid on%% USe the PSD to filter out noise
indices PSD>35000; PSDclean = PSD.*indices;fhat = indices.*fhat; ffilt = ifft(fhat); figure;plot(t,ffilt);
Best Answer