1
$\begingroup$

fm=20000 and I am sampling following signal at 65000 Hz:

x=0.5*sin(2*pi*(fm-2500)*t)+0.6*sin(2*pi*(fm-1250)*t*1.05)+0.7*sin(2*pi*fm*t*1.1)+0.8*sin(2*pi*(fm+1250)*t*1.15)+0.9*sin(2*pi*(fm+2500)*t*1.2);

and looking at frequency spectrum is not as it should look like. Please find attachment. It has code and result also.Code and results are there in image

$\endgroup$

2 Answers 2

3
$\begingroup$

The effect you see has nothing to do with aliasing. First of all, due to spectral leakage the maxima of the spectrum do not exactly reflect the amplitudes of the sinusoids. Second, note that the DFT (implemented by the FFT) only samples the actual spectrum (the discrete-time Fourier transform, DTFT) of the signal. Depending on the choice of the sampling frequency in your example, the actual spectrum (DTFT) and the location of the sample points of the DFT shift with respect to each other, and there's no guarantee that the samples of the DFT occur at (or close to) the maxima of the actual spectrum.

$\endgroup$
0
$\begingroup$

You will avoid this spectral leakage by setting your t to:

t=0:1/fs:1-(1/fs)

like that you have exactly 65K samples and not 65K+1.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.