My first derivative Pick detection code is given bellow:
ind = find(g(1:end-1).*g(2:end) < 0)+1;
plot(t,x, t(ind), x(ind), 'o');
Now, I want to write second derivative pick direction by using above code.
The second derivative equation is
Y1(n) = [x(n)-2x(n-2)+x(n-4)]
Please, help me to write the code for Second derivative