My code is :
Fs=200e6;
Ts=1/Fs;
NFFT=2^14;
Runtime=(NFFT-1)*Ts;
t=0:Ts:Runtime;
f_in=90*1e6;
y_in=sin(2*pi *f_in *t);
plot(t,y_in)
ylim([-1.5 1.5])
Then why does my plot look like amplitude modulated when you zoom into it?
Signal Processing Stack Exchange is a question and answer site for practitioners of the art and science of signal, image and video processing. It only takes a minute to sign up.
Sign up to join this communityMy code is :
Fs=200e6;
Ts=1/Fs;
NFFT=2^14;
Runtime=(NFFT-1)*Ts;
t=0:Ts:Runtime;
f_in=90*1e6;
y_in=sin(2*pi *f_in *t);
plot(t,y_in)
ylim([-1.5 1.5])
Then why does my plot look like amplitude modulated when you zoom into it?
This visual phenomenon appears because the maximum frequency is close to the Nyquist frequency, or half the sampling frequency. Sampling begins to approach the limit of $2$ samples per period, and thus the linear interpolation performed by Matlab becomes highly inaccurate. However, samples are correctly located, as you can see from the code where an higher sampling ('Oversampled') is superimposed:
Fs=200e6;
Ts=1/Fs;
NFFT=2^14;
Runtime=(NFFT-1)*Ts;
t=0:Ts:Runtime;
f_in=90*1e6;
y_in=sin(2*pi *f_in *t);
Fs2=20*Fs;
Ts2=1/Fs2;
NFFT=2^14;
t2=0:Ts2:Runtime;
f_in=90*1e6;
y_in2=sin(2*pi *f_in *t2);
clf;hold on;
plot(t,y_in,'x')
plot(t2,y_in2,'-')
ylim([-1.5 1.5])
xlim([5.2 5.4]*1e-6)
legend('Original','Oversampled')