Computing narrowband spectrograms using MATLAB
No one is going to give you a full working code - the point is that you should learn and understand how to do it. Following guidelines for you:


As given, use the wavread function to load the recording (please mind that in the newest 2014a version this function is deprecated, you should use audioread instead). MATLAB has wonderful help with very good examples, so simply use it.
Having your signal loaded, together with its sampling frequency, you need to split it into chunks (many short-time frames). This can be done in two ways, either you are using a loop construct (for, while - whichever you prefer), or (my favourite) use the MATLAB buffer function (please consider using 'nodelay' option in it, as first frame will have zeros in it up to overlap length). Although you require the Signal Processing Toolbox license (I'm sure your University has it). This function allows you to specify the length of frame, overlapping and other things. In result you will obtain the matrix which columns are your signal frames. Having the sampling frequency from wavread, it is very easy to calculate corresponding length of your frame in samples for given number of miliseconds
Now you can iterate over the columns of your matrix and calculate the FFT for each of them. You might want to use the fft function to get it. In extra parameter you can specify the length of your signal (to apply zero padding eventually). So let's say that now you have FFT for first frame. Now take the magnitude of it (abs), and choose first 512 samples. Store this result into fist column of your super matrix $S$. Optional step: before calculating the FFT, I suggest you to multiply your frame by the window function, i.e. hamming window. 
Now you have the matrix $S$, so plotting can be done by using various functions (pcolor, imagesc, and so on - pick whichever you prefer).


I suggest you to compare the final result with MATLAB built-in spectrogram function. 

Good luck!