The cross correlation function xcorr() will produce an output with 2*M-1 elements where M is the number of elements in the input. Perhaps you want to plot the results as a function of the lag.
C = C*Tmax;
Note that your subplots are not defined correctly. Assuming you want two vertically stacked subplot, the subplot definitions should be