Advertisement
ostyleo

Untitled

Nov 10th, 2017
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.60 KB | None | 0 0
  1. function Triunghi( Pa, Pb, Pc, level )
  2. if level==0
  3. fill([Pa(1), Pb(1), Pc(1)], [Pa(2), Pb(2), Pc(2)], 'r')
  4. hold on
  5. else
  6. Triunghi(Pa, (Pa+Pb)/2, (Pa+Pc)/2, level-1)
  7. Triunghi(Pb, (Pc+Pb)/2, (Pa+Pb)/2, level-1)
  8. Triunghi(Pc, (Pa+Pc)/2, (Pb+Pc)/2, level-1)
  9. end
  10. end
  11.  
  12. %EX APEL Triunghi ([1,2],[3,4],[2,5],3)
  13.  
  14. ----------------------------------------------------------
  15.  
  16. function sirprinski(n)
  17. s = 0;
  18. for k = 1:n
  19. s= [s,s,s; s,ones(3^(k-1)),s; s,s,s];
  20. end
  21. imagesc(s); colormap(gray);
  22. axis equal; axis off;
  23. end
  24. % PATRATUL
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement