It is demonstrated that optical coherence function can be synthesized into almost any arbitrary shape by stepwise spectral modulation of a laser source and synchronous phase modulation. In this presentation, the coherence function is synthesized experimentally into three forms, a scanning delta-function-like peak, a scanning peak with low side-lobes, and a standing triangle, respectively. The lasing frequency of a broadband tunable super-structure-grating distributed Bragg reflector laser diode (SSG-DBR-LD) is stepwise modulated. The spectral intensity is tailored with a semiconductor optical amplifier (SOA) to fit the spectral patterns required by correspondent coherence functions. The synthesized coherence functions are employed for distributed fiber optic stress sensing or stress locating. A polarization maintaining optical fiber (PMF) is used as the sensing element. When a stress is applied to the PMF, polarization mode coupling occurs; then an optical path difference between the two polarization modes appears due to their different propagation speeds. The optical path difference can be figured out by manipulating the coherence function. When using the coherence function of scanning peak, the coherence peak is moved to scan the detection range by the phase modulation; therefore, the stress distribution can be obtained. When using triangular coherence function, the detection range is set within a linear slope of the triangle, so the stress location is directly converted into the value of the coherence degree.