1
$\begingroup$

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?

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

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:

Tightly and oversampled sine signals

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')
$\endgroup$
  • 1
    $\begingroup$ Thankyou Laurent, so, i should not worry about the shape of the signal, and proceed forward without worrying about it ? $\endgroup$ – BandW Aug 22 at 15:51
  • $\begingroup$ It is always useful to worry about the shape on the samples. The importance depends on what you want to do next $\endgroup$ – Laurent Duval Aug 22 at 16:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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