MATLAB: FFT Peaks Resolver Signal

resolver

Hello to all,
I wanted to create a FFT for a resolver Signal. The excitation voltage has a frequency of 5kHz, so I expected one Peak to be at that point. But when I plot the FFT, the Peak is located at 10kHz? The lower frequency for the resolver revolutions seems to be right.
This is my code for generating the FFT:
%%FFT Resolver
Fs = 80000;
fn = Fs/2;
N = length(r_sin);
df = Fs/N;
x_fa = 0 : df : Fs-df;
fft_sin = fftshift(abs(fft(r_sin, N))/N);
fft_cos = fftshift(abs(fft(r_cos, N))/N);
plot(x_fa-fn,[20*log10(fft_sin) 20*log10(fft_cos)])
title('Resolver FFT')
xlabel('Frequency [Hz]')
ylabel('Amplitude [dB]')
legend('sin', 'cos')
xlim([0 40000])
ylim([-150 -20])
Is my code wrong or is this the correct behavior?
Thanks a lot in advance!
Regards, Sven

Best Answer

t=0:(1/80000):(79999/80000);
r_sin=sin(2*pi*5000*t).';
r_cos=sin(2*pi*5000*t).';
If applied to synthetic input signals, the code produces the expected results (peaks at +/-5000 Hz). Maybe the frequency in the actual signal is at 10 kHz, or the actual signal was sampled at 40kHz instead of 80kHz?