function [loc,pks] = find_peaks(data, minvalue)

    data_grad = gradient(data);
    data_grad_grad = gradient(data_grad);
    data_cross_idx = round(zerocrossing(1:length(data_grad), data_grad));
    data_cross_idx(data_grad_grad(data_cross_idx) > 0) = [];
    data_cross_idx(data(data_cross_idx) < minvalue) = [];
    pks = data(data_cross_idx);
    loc = data_cross_idx; 

end
