# Why does my sinusoid look “AM” in shape?

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?

• Welcome to SE.DSP. Following the formatting as edited, do not hesitate to present your code in a more readable and executable form. – Laurent Duval Aug 22 '19 at 14:50

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')

• Thankyou Laurent, so, i should not worry about the shape of the signal, and proceed forward without worrying about it ? – BandW Aug 22 '19 at 15:51
• It is always useful to worry about the shape on the samples. The importance depends on what you want to do next – Laurent Duval Aug 22 '19 at 16:09