is there any algorithm for the peak finder in numeric signal for example if we have x = [ 0.01 -0.5 0.02 0.5 0.003 0.8 1 0 0 0 -1 0 0.0001 0 0 0 ] , as you see we have 5 peak sample ( -0.5 , 0.5 , 0.8 , 1 , -1 ) , these peaks must capture 80 % of energy of signal x ?:roll:
If I understand your question, it's a pretty straight-forward solution, although you don't say how you're trying to implement this: ASIC? C-code? FPGA??
Something like this:
slope=sgn(x(n-1)-x(n-2)--positive or negative slope
if slope>0 and x<x(n-1)
peak=x(n-1)
elsif slope<0 and x>x(n-1) then
peak=x(n-1)
end if
Thank you barry for reply and can you please correct my Matlab code if i'm wrong :
x = [ 0.01 -0.5 0.02 0.5 0.003 0.8 1 0 0 0 -1 0 0.0001 0 0 0 ];
for i =1:numel(x)
Treshold = 0.85;
x_energy = abs((x).^2);
x_sort = sort(x_energy); % sorted in ascending order of energy
cum_energy = cumsum(x_sort(end:-1:1)); % cumulative energy
ind = min(find(cum_energy >= Treshold * cum_energy(end)));
num_sig_component (i) = ind ;
end