In the framework of kinematic theory of scattering the intensity distribution formed by surface layers with concentration gradient of some elements was developed We have worked out a computer program to restore X-ray intensity distribution by such surface layers in radial direction (parallel to reciprocal lattice vector). Computer simulation allows to find out diffusion coefficient even in this case. Procedure was applied to analyse different surface layers as to nitriding of iron alloys as to oxidation of HTSC layers.