rotateVec - shifted_vec=[row_vec(end-(shifts-1):end);...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
function shifted_vec=rotateVec(row_vec,number_shifts) %function to barrel shift on the vector by that number %usage: shifted_vec=rotateVec(row_vec,number_shifts) shifts = mod(number_shifts,length(row_vec)); %finds the number of shifts actually performed on the vector; after the %vector shifts its length, then the pattern will simply repeat itself
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: shifted_vec=[row_vec(end-(shifts-1):end); row_vec(1:end-shifts)]; %shifts the vector shift times; we have to do end - (shift - 1) because %this will give us our starting position (just hard code examples and see %the pattern that occurs when you start indexing your answers relative to %your original array...
View Full Document

Ask a homework question - tutors are online