MATLAB: Dividing a set of numbers into set of intervals and caculating the mean of each interval and comparing it with the previous one

a_s

Hi. I have a set of random numbers let's say x=[-2,-4,-7,-1,…,-3], and I need writting a code to divide x into equal intervals (let's say each interval has 50 numbers), then I want to caculate the mean of each interval and compare it with the mean of the previouse interval. Can any one help me with that please. your help is much appreciated in advanced.

Best Answer

subs=discretize(x,50); %50 intervals
intervalMeans=accumarray(subs(:),x(:),[],@mean)
Related Question