Most significant samples

Status
Not open for further replies.

Big.Head

Newbie level 6
Joined
Mar 3, 2012
Messages
14
Helped
1
Reputation
2
Reaction score
1
Trophy points
1,283
Location
UAE
Visit site
Activity points
1,352
Hello,

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:

Thanks in Advance ,
 

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
 

Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…