function x = percent(y,m)

if (length(y)/m<1)
  error('m is too large')
end;

L = length(y);
s = linspace(0,L,m+1);

y = abs(y);
for k = 1:m
    x(k)=sum(y(floor(s(k))+1:floor(s(k+1))))/sum(y)*100;
end

