% Matlab commands to rotate and plot a 3-simplex % List, with some repetition, the vertices of the 3-simplex in some % traversal order that generates a wire frame: simp=[0 0 0; 0 0 1; 0 1 0; 0 0 0; 0 1 0; 1 0 0; 0 0 0; 1 0 0; 0 0 1; 0 0 0]; % Label the axes manually and have MatLab retain all previous drawings: axis([-1.2 1.2 -1.2 1.2 -1.2 1.2]); axis manual; hold on; % Plot the 3-simplex in its initial position. plot3(simp(:,1), simp(:,2), simp(:,3)) % Givens rotation matrices in 3-space c=cos(0.3); s=sin(0.3); rot12=[ c s 0; -s c 0; 0 0 1] % about X-axis rot13=[ c 0 s; 0 1 0; -s 0 c] % about Y-axis rot23=[ 1 0 0; 0 c s; 0 -s c] % about Z-axis % Rotate by multiplication on the right simp = simp*rot12; plot3(simp(:,1), simp(:,2), simp(:,3)) simp = simp*rot23; plot3(simp(:,1), simp(:,2), simp(:,3)) simp = simp*rot13; plot3(simp(:,1), simp(:,2), simp(:,3))