I am trying to test a signal in the frequency domain. For the test I have tried a continuous wave, a sinus. I have noticed that the spectral amplitude of my signal change in function of its frequency (F1 in my example).
I have my Pin1_dBm only for F1 very low...
is it linked to the time windowing too long that we see a sort of sincardinal in the frequency domain?
here is the script :
Fs = 1e3; %sample frequency
F1=0.42e3; %signal frequency
Tstop=2.54e6/Fs; %time window - duration of my simulation
t = 0:1/Fs:Tstop; %time step
Pin1_dBm=10; %power level of my signal
nbre_step=Tstop*Fs; %number of time steps during my time window
x = sqrt(2*10^((Pin1_dBm-30)/10))*cos(2*pi*F1*t); % my signal (Continuous wave)
In_spectrum_2sided_W=(abs(fft(x))/nbre_step).^2; %spectrum 2 sided in Watts
In_spectrum_1sided_W(2:end-1)=2*In_spectrum_1sided_W(2:end-1); %spectrum 2 sided->1sided in Watts
In_spectrum_dBm=10*log10(1000*In_spectrum_1sided_W); %spectrum in dBm