function y=functent(x) % % Function to return the Tent Map iterated nrepeat times % global nrepeat % Needs nrepeat shared with calling program xx=x; % In this case don't want to overwrite calling argument for k=1:nrepeat xx=2*(0.5-abs(xx-1/2)); % Mapping is x(n+1)=2*(0.5-abs(1/2-x_n)) end y=xx;