An Analytical Method of Calculating Variable Diffusion Coefficients