You have the basic idea, but first you have some formatting issues as posted (which might not be in what you are executing). And it's not clear what you expect to see (one cycle? more?) in the plots.
The formatting issues: First, "ts = 1/fs;" should be split onto another line, othewise it gets lost in the preceding comment. Second, "pifcts" should be "pi * fs *ts". Equivalently, you can simplify by getting rid of ts altogether and dividing by fs.
One conceptual problem is you define nn as "from 0 to fc". It has no relationship with fc, it's simply how many points you want to plot to the screen.
Finally, because you're plotting a frequency fs of one-fourth the sample rate fc, you'll end up plotting only a quarter cycle. You probably want to see at least a full cycle, so you'd need to multiply by another factor as well.
I'll assume you want to start by seeing one cycle to prove you were right about the complex exponential. So, the plot here is simply 0 to 2pi, one cycle. Multiple the 2*pi by fc/fs if you want to scale for frequency, and if you want to show more cycles in the plots multiply by a factor greater than one to do that.
plotPoints = 1000; % number of points in plot
nn = [0 : plotPoints - 1];
y1 = exp(i*2*pi * nn/plotPoints); % exponential equation from 0 to 2pi
cosine = real(y1); sine = imag(y1);
subplot(1,2,1); plot(cosine); axis tight; grid on;
subplot(1,2,2); plot(sine); axis tight; grid on;
