The resolution of optical coherence tomography (OCT) depends on the spectral properties of the light sources used in OCT systems. The minimum distance that can be resolved by this technique is inversely proportional to the spectral width of the light source. Using broadband light sources, ultrahigh-resolution OCT can achieve axial image resolutions on the few micron scale. However, dispersion is known to increase the width of the envelope of the OCT signal and to reduce the resolution of OCT because different wavelengths of a broadband light source have different velocities in dispersive media. In the present paper, a super-luminescent diode (SLD) source is used to characterize the dispersion of different samples. The center wavelength of the light source is 845nm and spectral width is 26nm. A 30mm thick BK7 glass slab is tested. Based on the measured source spectrum, the broadened signals are calculated with the specific dispersion coefficients of different materials. The calculated signals are compared with the results measured in the experiments. A general numerical dispersion compensation method is present, which can both be applied in time domain and in frequency domain. Using this automatic iterative optimization method, the unbroadened signal can be regenerated with high resolution.