function [l,r]=partition(n,p,o) % PARTITION % % split the set [1,n] into p intervals with overlap o % return the left and right endpoints % % I assume that n=2^q+o, which allows for a perfect split with % all intervals having equal length % % function [l,r]=partition(n,p,o) % l=zeros(p,1); r=zeros(p,1); base=n-o; len=(base/p)+o-1; l(1)=1; r(1)=len+1; for i=1:p-1 r(i)=l(i)+len; l(i+1)=r(i)-o+1; end r(p)=l(p)+len; if (r(p)~=n) disp('partition error'); return end