- Category:
- File Formats
- Tags:
-
[WORD]
- File Size:
- 43kb
- Update:
- 2013-03-02
- Downloads:
- 0 Times
- Uploaded by:
- 郑志森
Description: Fractal
Exercise One
The ① Koch curve
Plural iteration Koch curve
clear i to prevent i is reassigned
A = [0 1] initial A is a connection (0,0) and (1,0) of the segments
t = exp (i* pi/3)
n = 2 n is the number of iterations
for j = 0: n
A = A/3 a = ones (1,2* 4 ^ j)
A = [A (t* A+ a/3) (A/t+ (1/2+ sqrt (3)/6* i)* a) A+2/3* a]
end
plot (real (A), imag (A))
axis ([0 1-0.1 0.8])
② Sierpinski triangle
A = [0 1 0.5 0 0 1] initialized A
n = 3 the number of iterations.
for i = 1: n
A = A/2 b = zeros (1,3 ^ i) c = ones (1,3 ^ i)/2
A = [A A+ [c b] A+ [c/2 c]]
end
for i = 1:3 ^ n
patch (A (1,3* i-2: 3* i), A (2,3* i-2: 3* i), b ) patch filled function
end
To Search:
File list (Check if you may need any files):
分形.doc