  High-fidelity two-qubit gates in quantum computers are often hampered by
fluctuating experimental parameters. The effects of time-varying parameter
fluctuations lead to coherent noise on the qubits, which can be suppressed by
designing control signals with appropriate filter functions. Here, we develop
filter functions for M{\o}lmer-S{\o}rensen gates of trapped-ion quantum
computers that accurately predict the change in gate error due to small
parameter fluctuations at any frequency. We then design the filter functions of
frequency-modulated laser pulses, and compare this method with pulses that are
robust to static offsets of the motional-mode frequencies. Experimentally, we
measure the noise spectrum of the motional modes and use it for designing the
filter functions, which improves the gate fidelity from 99.23(7)% to 99.55(7)%
in a five-ion chain.
