function y=plotIFS(NumFunc,Numits,A) % function y=plotIFS(NumFunc,Numits,A) % % Plot the Iterated Function System defined in the array A (NumFunc x 6) % using Numits points. % % The output y is the set of points plotted y=zeros(2,Numits); %Storage for plotting. x=rand(2,1); %Current point in the orbit. z=zeros(2,1); %Used for computation. %We’ll be throwing away the first few points... for i=1:100 k=randi(NumFunc); z(1)=A(k,1)*x(1)+A(k,2)*x(2)+A(k,5); z(2)=A(k,3)*x(1)+A(k,4)*x(2)+A(k,6); x=z; end %Keep these for plotting for i=1:Numits k=randi(NumFunc); z(1)=A(k,1)*x(1)+A(k,2)*x(2)+A(k,5); z(2)=A(k,3)*x(1)+A(k,4)*x(2)+A(k,6); y(:,i)=z; %Store these for plotting. x=z; end %% Here is the plot: plot(y(1,:),y(2,:),'.'); axis equal return