# Cannot recreate a simple Nyquist series in Matlab

a Nyquist series should look something like {...-1, 1, -1, 1, ... }, which i think means it is a sine wave sampled at the peaks and valleys exactly.

Now, given a sampling rate of 48 Hz, the Nyquist frequency should be 24 Hz.

If I am not mistaken, Nyquist series is basically the the dataset of a sine wave of frequency = Nyquist Frequency, sampled at the sampling rate given above.

in short, these are my matlab vars:

SR = 48;             //sampling rate (hz)
X  = 0:1/SR:2*pi;    //domain (time in general)
fNy= SR/2;           //nyquist frequency
Y1 = sin(2*pi*fNy*X);// a sine wave with freq = nyquist frequency.


when i plot X and Y1, i get a really messed up plot. (i think its zero since its so small in magnitude) I believe that Y1 should be exactly = 1, -1, 1, -1, 1, -1 ... Where did I go wrong? thanks

Try Y1 = cos(2*pi*fNy*X);
(And think about the $x$-axis values at which you sampled the sine)
• @zellwwf: You sampled the sine at $k\pi$, $k=0,1,\ldots$, i.e. exactly at its zeros, and what you saw was numerical noise. Jun 3 '15 at 15:01