Home » Posts tagged 'Fractals'

Tag Archives: Fractals

Ford Circles

clc; close all; fi = 0:0.01:2*pi;

```figure('Position',[0 0 500 500])
hold on;
for h =1:15
for k = 1:15
R  = 1/(2*k^2);
x  = h/k + R*sin(fi);
y  = 1/(2*k^2) + R*cos(fi);
plot(x,y,'k');
% Symmetric
y  = -(1/(2*k^2) + R*cos(fi));
plot(x,y,'k');
end
end
axis([0, 2.2,-1.1, 1.1 ]);axis off;```

Box Fractals

clc; clear all; close all;

```a = 1;
figure('Position',[0 0 800 800])
for i = 1 :5
[n m] = size(a);
Z = zeros(n,m);
a = [a,Z,a;
a,a,a;
a,Z,a
];
end
imagesc(a);
colormap bone;axis off;
caxis([0, 1]);```

```clc; clear all;
a = 1;
figure('Position',[0 0 800 800])
for i = 1 :5
[n m] = size(a);
Z= zeros(n,m);
a = [Z,a,Z;
a,a,a;
Z,a,Z
];
end
imagesc(a);
colormap bone;axis off;
caxis([0, 1]);```

```clc; clear all;
a = 1;
figure('Position',[0 0 800 800])
for i = 1 :5
[n m] = size(a);
Z= zeros(n,m);
a = [a,a,a;
a,Z,a;
a,a,a
];
end
imagesc(a);
colormap bone;axis off;
caxis([0, 1]);```

```clc; clear all;
a = 1;
figure('Position',[0 0 800 800])
for i = 1 :5
[n m] = size(a);
Z= zeros(n,m);
a = [a,Z,a;
Z,a,Z;
a,Z,a
];
end
imagesc(a);
colormap bone;axis off;
caxis([0, 1]);

```
```clc; clear all;
a = 1;
figure('Position',[0 0 800 800])
for i = 1 :5
[n m] = size(a);
Z= zeros(n,m);
if mod(i,2) == 0
a = [Z,a,a;
a,a,a;
a,a,a
];
else
a = [a,a,a;
a,Z,a;
a,a,a
];
end
end
imagesc(a);
colormap bone;axis off;
caxis([0, 1]);```

Carotid-Kundalini function

clc; clear all; close all;

```figure('Position',[0 0 800 800])
hold on;
x  = -1:0.005:1;
sz = size(x);
for n = 1:15
for i = 1:sz(2)
CK(i) = cos(n*x(i)*acos(x(i)));
end
plot(x,CK,'k');
axis off;
end```

Slightly modifing the Carotid-Kundalini function

```x  = -1:0.005:1;
sz = size(x);
for n = 1:25
for i = 1:sz(2)
for j = 1:sz(2)
CK(i,j) = cos(n*(x(i))*acos(x(i)))+...
cos(n*(x(j))*acos(x(j)));
end
end
end
figure('Position',[0 0 800 800])
imagesc(CK);
colormap bone;
axis off;```

Butterfly Fractal

clc; clear all; close all;

```x  = -1:0.005:1;
sz = size(x);
a  = 0.05;
for i =1:sz(2)
for j = 1:sz(2)
bf(i,j) = ((x(i)^2-x(j)^2)*sin((x(i) + x(j))/a))/(x(i)^2 + x(j)^2);
end
end
fig = figure('Position',[0 0 800 800]);
imagesc(bf);
colormap bone;axis off;
set(fig, 'color', [0 0 0]);```