If I understand correctly what you want to do, this seems to work (requires the Signal Processing Toolbox for findpeaks):
D = load('sigX');
x = D.req_read(:,1);
y = D.req_read(:,2);
dy = gradient(y, mean(diff(x)));
[dypks,ix] = findpeaks(dy, 'MinPeakDistance',20, 'MinPeakHeight',1E+7);
figure(1)
plot(x, y)
hold on
plot(x, dy*1E-9)
plot(x(ix), dypks*1E-9, '^g', 'MarkerFaceColor','g')
hold off
grid
axis([0 1E-7 ylim])
It is fairly straightforward. It uses the gradient function to take the derivative of the signal, then uses the Signal Processing Toolbox findpeaks function to find the peaks in the derivative, corresponding to the rising edges of the signal. I included in the findpeaks call threshold values for the magnitude of the peaks to include (in 'MinPeakHeight') and the distance between then (in 'MinPeakDistance').
The findpeaks function returns the value (height) of the peaks in ‘dypks’ and their index locations in ix that you can then use to locate the peaks with respect to ‘x’. The plot calls illustrate this usage. The scaling factor of 1E-9 scales the derivative plot to the original signal so that I could overplot the derivative and the signal to verify that the derivatives did what I wanted them to. Also, the axis call shows a part of the signal in detail. Comment it out to see the entire signal.
Best Answer