Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- % https://www.reddit.com/r/dataisbeautiful/comments/8gltik/3d_plot_of_the_bitwise_xor_of_integers_32_to_32/
- % https://imgur.com/wbnRfyO
- % plot
- [X,Y] = meshgrid(-32:32);
- Z = bitxor(X, Y, 'int32');
- scatter3(X(:), Y(:), Z(:), 12, '.')
- axis vis3d tight, box on
- % animation
- createGIF('out.gif', gcf)
- for i=1:120
- camorbit(3, 0)
- drawnow
- createGIF('out.gif', gcf)
- end
- function createGIF(fname, h)
- [im, map] = rgb2ind(frame2im(getframe(h)), 256);
- if exist(fname, 'file') == 2
- opts = {'WriteMode','append'};
- else
- opts = {'LoopCount',Inf};
- end
- imwrite(im, map, fname, 'gif', 'DelayTime',1/25, opts{:});
- end
Add Comment
Please, Sign In to add comment