MatLab Solutions: "Introduction to Digital Signal Processing: A Computer Laboratory Textbook".
29 Oct 2012
25 Nov 2013)
These files are the MatLab solutions of exercises contained in the above DSP lab textbook.
function y = shiftright(x,n)
% This function shifts to the right (left) the contents of a row vector
% and inserts zeros at the left (right)- most places.
% If n>0 (n<0), it moves the contents to the right (left).
% x is assumed a row vector.
x = x(:).';
N = length(x);
y = zeros(1,N);
y = [ zeros(1,n) x([1:N-n]) ];
y = x;
y = [ x([-n+1:N]) zeros(1,-n) ];
disp('Error: Shift length should be less than or equal to given vector''s length')