Azzera filtri
Azzera filtri

Single-Sided Amplitude Spectrum Plot

6 visualizzazioni (ultimi 30 giorni)
twig27
twig27 il 28 Nov 2016
Risposto: Star Strider il 28 Nov 2016
Hello,
I have a question regarding the fourier spectrum of a signal. Below I've posted code in which I generated a sinusoidal signal with a frequency of 5 kHz. Then I plotted the single-sided amplitude spectrum as recommended in the MathWorks documentation. The plot however does not show a peak of height 1 at 5 kHz, but a slightly lower one plus more frequencies in the vicinity. What happened there? Since my sampling rate is 20 kHz I dont suppose to violate the Nyquist theorem. Thanks for any hints!
if true
delta = 50E-6;
fs = 1/delta;
time = 0:delta:1;
f = 5E3;
signal = sin(2*pi*f*time);
figure;
plot(time,signal);
x = signal;
y = fft(x);
L = length(x);
P2 = abs(y/L);
P1 = P2(1:L/2+1);
P1(2:end-1) = 2*P1(2:end-1);
freq = fs*(0:(L/2))/L;
figure;
%loglog(freq,P1);
%semilogy(freq,P1);
plot(freq,P1);
end

Risposta accettata

Star Strider
Star Strider il 28 Nov 2016
‘The plot however does not show a peak of height 1 at 5 kHz, but a slightly lower one plus more frequencies in the vicinity. What happened there?’
In ‘sampling’ your signal, you are actually ‘heterodying’ it with (modulating it with) the sampling frequency. Like all amplitude-modulation processes, this creates sidebands, so you end up with a transmitted-carrier double-sideband signal. The discrete Fourier transform is by definition a nonlinear process as well, so the result displays the fundamental frequency and sidebands, with the energy distributed amongst them.

Più risposte (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by