Part 1
Choose the signal $ x(t)=cos(t) $ which is periodic.
Sampling ever interger yields
This is $ x[n]=cos(n) $
but sampling at a frequency of $ \pi/4 $ yields
This is $ x[n]=cos(\pi/4n) $
Part 2
This is $ x(t)=e^{-t}cos(20t) $ as the nonperiodic signal.
I haven't played around with matlab enough to know how to create the signal needed with my own code, so I used the same code that Ben Laskowski used:
"y=zeros(size(x));
for count=1:period/delta:(nperiod+8)*period/delta
y(1,count:size(y,2))=y(1,count:size(y,2))+f(1,1:size(y,2)-count+1);
end
plot(x,y)"