Jun 7, 2005 #1 D davyzhu Advanced Member level 1 Joined May 23, 2004 Messages 494 Helped 5 Reputation 10 Reaction score 2 Trophy points 1,298 Location oriental Activity points 4,436 Hi all, How to generate the shift identity matrix by its size and shift vaule? For example,input size = 8, input shift value = 3 then, the matrix is 0 0 0 1 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 1 0 0 0 0 0 Any easy approach will be appreciated! Best regards, Davy
Hi all, How to generate the shift identity matrix by its size and shift vaule? For example,input size = 8, input shift value = 3 then, the matrix is 0 0 0 1 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 1 0 0 0 0 0 Any easy approach will be appreciated! Best regards, Davy
Jun 7, 2005 #2 eng_Semi Full Member level 6 Joined May 3, 2005 Messages 325 Helped 37 Reputation 74 Reaction score 6 Trophy points 1,298 Location Egypt Activity points 4,111 m( 1 , : ) = [0 0 0 1 0 0 0 0]; i = 1; for i = 2 : 8; m( i , : ) = circshift( m( i - 1 , : ), [1 1]); end
m( 1 , : ) = [0 0 0 1 0 0 0 0]; i = 1; for i = 2 : 8; m( i , : ) = circshift( m( i - 1 , : ), [1 1]); end