function [changepoint,changemagnitude]=find_change_point_using_trend_method(input_data) %this is coded from a method by taylor, http://www.variation.com/cpa/tech/changepoint.html %possible future additions include the consideration of a second candidate change point, to be identified at the same time as the first one %see also change_point_analysis_trend_method_with_bootstrap %change point analysis for variance also? c=cumsum(input_data-mean(input_data)); %[maxval_original maxind_original]=max(c); [minval_original minind_original]=min(c); changepoint=minind_original; changemagnitude=minval_original; %alternative metric for change magnitude: diff_original=maxval_original-minval_original;