Cosine function to determine refresh rate