Fixed code to calculate correct frequency of AC signal.

- Matthew Lu (from Kevin's computer)