We demonstrate an approach for triangular-shaped pulse train generation experimentally based on harmonic fitting. The operation principle is that a Mach-Zehnder modulator is firstly employed to suppress modulation of the optical carrier. Thus a periodically variable lightwave can be obtained at the output. Then the signal is coupled into a section of dispersive fiber. Due to the dispersion-induced power fading, the undesired 4th order harmonics in the optical intensity can be fully removed. By adjusting modulation index to an optimum value (m=2.305), the generated harmonics of the optical intensity can be made corresponding to the Fourier components of typical periodic triangular pulses. Finally, the triangular-shaped pulse train at a repetition rate two times of the driving frequency can be obtained. In the experiments, 19.724 Gb/s and 15.356 Gb/s triangular-shaped pulse trains are generated by using 9.862 GHz and 7.678 GHz driving signals respectively. Besides, the repetition rate can be switched to another value by using a different fiber dispersion ( 2L). It is found that the experimental data agree well with theoretical results.