hello Hamid and welcome back again
you can see below that fft and my home made DFT computations give the same spectrum. Also notice here that I limited the computation to orders from 0 (dc term) to 128; you can of course change that upper limit, but if you reduce it you will notice that the reconstructed signal (in red) will be more approximate (as you would get by applying a low pass filter)
once we are in the frequency domain, the x vector is the inverse of your angular (revolution) - we can either speak in "order" (orders extraction, synchronous fft it's all the same stuff) or in 1/rev frequencies which is identical.
raw and reconstructed signals :
fft vs home made dft spectrum computation :
notice they are identical !
code :
data = readmatrix('Force_deg.xlsx');
A(k) = 2/n*trapz(yc.*cosd(k*theta));
B(k) = 2/n*trapz(yc.*sind(k*theta));
tmp = A(k)*cosd(k*theta) + B(k)*sind(k*theta);
plot(theta, y, 'b',theta, yfitsum, 'r')
legend('data','model fit - all orders');
AB_mag = [C sqrt(A.^2+B.^2)];
subplot(2,1,1),plot(0:orders, AB_mag, 'bo-')
title('Signal Spectrum - my DFT')
[f1,fft_spectrum1] = do_fft(theta./max(theta),y);
fft_spectrum1(1) = fft_spectrum1(1)/2;
subplot(2,1,2),plot(f1(ind),fft_spectrum1(ind),'-*')
title('Signal Spectrum - matlab fft')
xlabel('Frequency[1/revolution]')
function [freq_vector,fft_spectrum] = do_fft(time,data)
fft_spectrum = abs(fft(data))*2/nfft;
select = (1:(nfft+1)/2)';
fft_spectrum = fft_spectrum(select,:);
freq_vector = (select - 1)*Fs/nfft;