Discrete Fourier transformer is the most basic mathematical tool for spectrum analysis of a stable electrical signal,which is also the transformation approach recommended by International Electrotechnical Commission for harmonics and inter-harmonics measurement.When the analysis window length does not match the actual signal cycle, in the frequency domain the individual harmonic components appears fence effect. An improved DFT algorithm based on frequency domain expansion is proposed in this paper , which will make the frequency domain signal appropriate scalable,so that we can get the amplitude and phase angle on the discrete spectral lines directly, to overcome the fence effect, avoiding the interpolation operation , thereby improving the efficiency. Then simulation of the impact of noise and windowing is tested MATLAB, finally the new algorithm is compared with other methods. Simulation results show the effectiveness,accuracy and stability of the improved DFT algorithm based on frequency domain stretching.