Created energy_period.m written by David Christie