How can I generate a sine and cosine function using an exponential function?
If you have defined a sampling frequency then you should use it in defining your time grid "nn", otherwise you are just incrementing in digital steps.

The grid "nn" is basically a digital grid rather than representing true sampling based on your defined sampling frequency. Also the range of your time grid should be in mutliples of the time period of sinusoid (it could be anything but if you want to define it in that terms then define it in terms of time period of sinusoid and not the frequencies itslef).I have modified your code below to view 5 cycles of the sinusoid. Hope it helps

fc = 4092; % carrier frequency Hz

fs = 16368; % sampling freq Hz

nn = [0 : (1/fs):5*(1/fc)] % array with numbers from 0 to fc

y1 = exp(i*2*pi*fc*nn); % exponential equation