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


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


2 Answers 2


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.


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


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


Your Answer

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

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