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??
Zero padded OFDM (i.e.) adding zeros after IFFT is used to combat Inter symbol interference, suppose that there is multi path in the system that spans over L samples then atleast L zero samples are prefixed at the transmitter after IFFT so that these can be thrown away at the receiver and then recover ISI free IFFT frame / OFDM symbol.
The advantage of zero padding also has to do with power saving at the transmitter, the transmitter is simply switched off during the transmission of zero padded L samples duration. This has the advantage of saving power when compared to cyclic prefix OFDM which should then also transmit the cyclic prefix.
Zero padded OFDM though can leave to noise boosting and this is a disadvantage when compared to cyclic prefix OFDM. The equalization also would be non linear in case noise boosting is to be avoided. There is a lot of literature on zero padded OFDM you could refer to that as well.
Regarding the null sub carriers at the ends, these are implemented to reduce the ACLR and make the design of anti aliasing filters easier ( the cut off can be less sharp) hence save cost
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.