Home > other >  The IFS fractal tree
The IFS fractal tree

Time:09-19

Have understand iteration function system? This code is what's the problem? Running graphical wrong
The following is my MATLAB code:
 
N=10000;

% the IFS
M1=0.195 0.488 0.344 0.433 0.4431 [0.2452 0.25];
M2=[0.462 0.414 0.252 0.361 0.2511 0.5692 0.25];
M3=[- 0.058 0.07 0.453 0.111 0.5976 0.0969 0.25];
The M4=[0.035 0.07 0.469 0.022 0.4884 0.5069 0.2];
The M5=[0.637 0.0 0.0 0.501 0.8562 0.2513 0.05];

x=0; Y=0;

% r to [0, 1] interval of n-dimensional random group
R=rand (1, n);
B=zeros (2, n);

For I=1: n
If r (I) & lt; M1 (7)
A=M1 (1); B=M1 (2); E=M1 (3); C=M1 (4); D=M1 (5); F=M1 (6);
Else if r (I) & lt; M1 + M2 (7) and (7)
A=M2 (1); B=M2 (2); E=M2 (3); C=M2 (4); D=M2 (5); F=M2 (6);
Else if r (I) & lt; M1 + M2 (7) and (7) + M3 (7)
A=M3 (1); B=M3 (2); E=M3 (3); C=M3 (4); D=M3 (5); F=M3 (6);
Else if r (I) & lt; M1 + M2 (7) and (7) + M3 (7) + M4 (7)
A=the M4 (1); B=M4 (2); E=M4 (3); C=the M4 (4); D=the M4 (5); F=M4 (6);
The else
A=the M5 (1); B=M5 (2); E=M5 (3); C=the M5 (4); D=the M5 (5); F=M5 (6);
End
End
End
End

% affine transformation calculation
X=a + b * * x + y e;
Y=c * * y + x + d f;

B (1, I)=x; % on behalf of the k point of abscissa
B (2, I)=y; % on behalf of the k point coordinates in the
End

The plot (B (1, :), B (2, :), '. ', 'markersize', 1)

  • Related