Added function differentialthreshold

Takes data, differentiates, averages, and then find when that value
first goes over a certain threshold using thresholdindex.m.
Additionally, fixed thresholdindex to return the actual last threshold
index instead of the time of from the end where that occurs.