%This function computes the attractor of a specific IFS of R^2,
%using the Random Iteration Algorithm.
%Input: A0, W, P, N, K
%A0 is the initial point represented by a 1x2 matrix
%P is the matrix Nx1 containing the probabilities
%N is the number of the mappings
%K is the number of iterations
%W is the matrix Nx6 containing the parameters of the mappings
%Each row (i) contains the 6 coefficients of the map w_i. a,b,c,s,d,e
% / \ / \
% |a b| | d |
%w=| | + | |
% |c s| | e |
% \ / \ /
%The function plots the attractor!!!
%Therefore, you may want to open a new figure.
%Output: nothing
function B=MYRIA_R2(A0,W,P,N,K)
figure(1);
hold on;
SP(1)=P(1);
hist(1)=0;
for i=2:N
SP(i)=SP(i-1)+P(i);
hist(i)=0;
end;
X=A0(1,1);
Y=A0(1,2);
plot(X, Y , 'b.' , 'MarkerSize' , 2);
for (i=1:K)
what=rand(1);
for j=1:N
if what