I have a matlab code for OFDM system, in this code the auther added a zero padded subcarriers before the IFFT stage, in the middle of the raws, and added zero padded guard interval after IFFT, my question is that why i need to add zero padded subcarriers and what is the relation between the number of null subcarriers and sampling frequency??
The zero padding is there to minimize the effect of multipath.
Short explanation: over the air signal gets convoluted with channel response, this blurs the signal and redistribute its energy through a wider frequency range than the original. Ideally, if the channel response is shorter than the zero padding, the received signal can be accurately equalized using that information from higher frequencies by a simple deconvolution (in OFDM this is performed by multiplying in the frequency domain at the receiver). After a quick search through the link you posted, I cannot find the equalization step, so I guess this feature of OFDM is not implemented there.
Please, see if this makes sense to you and you can put all pieces together, right now I don't have time to further elaborate the answer.