Sierpinski triangle/Graphical: Difference between revisions

add MATLAB
m (→‎{{header|FreeBASIC}}: removed redundant code)
(add MATLAB)
Line 961:
 
[[File:MmaSierpinski.png]]
 
=={{header|MATLAB}}==
Fail to upload output images.
===Basic Version===
<lang MATLAB>[x, x0] = deal(cat(3, [1 0]', [-1 0]', [0 sqrt(3)]'));
for k = 1 : 6
x = x(:,:) + x0 * 2 ^ k / 2;
end
patch('Faces', reshape(1 : 3 * 3 ^ k, 3, '')', 'Vertices', x(:,:)')</lang>
===Bit Operator Version===
<lang MATLAB>t = 0 : 2^16 - 1;
plot(t, bitand(t, bitshift(t, -8)), 'k.')</lang>
 
=={{header|OCaml}}==
Anonymous user