Hi Debashish,
I assume that you want to plot (p,t). But p just has 2 elements and that is why it does not allow it to be plotted against "t". You only get 2 values for p because the control inside the for-loop does not execute some of the if-elseif conditions. In fact, it only enters the if-elseif condition block on only 2 occasions and so you get only 2 values for p. Try giving an else condition to the if-elseif block and assign some value to p in such cases. Once "p" and "t" are the same length, you should be able to plot them.
-Satya