Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function Triunghi( Pa, Pb, Pc, level )
- if level==0
- fill([Pa(1), Pb(1), Pc(1)], [Pa(2), Pb(2), Pc(2)], 'r')
- hold on
- else
- Triunghi(Pa, (Pa+Pb)/2, (Pa+Pc)/2, level-1)
- Triunghi(Pb, (Pc+Pb)/2, (Pa+Pb)/2, level-1)
- Triunghi(Pc, (Pa+Pc)/2, (Pb+Pc)/2, level-1)
- end
- end
- %EX APEL Triunghi ([1,2],[3,4],[2,5],3)
- ----------------------------------------------------------
- function sirprinski(n)
- s = 0;
- for k = 1:n
- s= [s,s,s; s,ones(3^(k-1)),s; s,s,s];
- end
- imagesc(s); colormap(gray);
- axis equal; axis off;
- end
- % PATRATUL
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement