The unit step function is just a series of 0's and 1's. That is easily written either using a for loop, or concantenating two vectors together, almost the same thing for the rectangle function. Now the triangle function can either be written as a function, or more elegantly as the convolution of two rectangle functions. The saw-tooth is just a finite linear line concantinated with itself a bunch of times.
As for the FFt's of these, they are very simple, Matlab has an FFT routine, just type in A =FFT(B) and they pop right out. If the input vectors are not powers of two long, there is another function, look in the help file, it is very very helpful, more so than any I have ever seen.