M=[0,1,0,0,0;0,0,1,0,0;0,0,0,1,0;0,0,0,0,1;1,0,0,0,0]
Z=M
[x,y] = meshgrid([-1:.5:1]);
x
y
surf(x,y,Z,Z)
clearplot
pause(.1)
Z=M*Z
surf(x,y,Z,Z)
clg
pause(.1)
Z=M*Z
surf(x,y,Z,Z)
clg
pause(.1)
Z=M*Z
surf(x,y,Z,Z)
clg
pause(.1)
% What happens when M is multiplied by itself five times?
Z=M*Z
surf(x,y,Z,Z)
clg
pause(.1)
 
Z=M+M^2+M^3+M^4+M^5
surf(x,y,Z,Z)
