import math


def get_pulse_plot(a, b, period):
    """Calculates formula to plot a cosine wave with vertical extremes a and b,
    with given x-period.
    :param a: Start position of cosine wave at x=0
    :param b: Opposite y extreme of cosine wave at x=period/2
    :param period: x-period of cosine wave
    :returns: Function to plot cosine wave given x
    """
    def pulse_plot(x):
        amp = (a-b)/2
        rad = (2*math.pi*x)/period
        return (amp*math.cos(rad)) + amp + b

    return pulse_plot