function y=double1(x) %FUNCTION y=double1(x) % This imlements the doubling function from Devaney's book, % D(x). y=2*x; idx=find(x>=0.5); %idx holds the indices of x whose %entries are >= 1/2 y(idx)=y(idx)-1; %Those entries in y get 1 subtracted