Code covered by the BSD License  

Highlights from
MatLab Solutions: "Introduction to Digital Signal Processing: A Computer Laboratory Textbook".

image thumbnail

MatLab Solutions: "Introduction to Digital Signal Processing: A Computer Laboratory Textbook".

by

 

29 Oct 2012 (Updated )

These files are the MatLab solutions of exercises contained in the above DSP lab textbook.

shiftdown(x,n)
function y = shiftdown(x,n)
% This function shifts down (up) the contents of a column vector
% and inserts zeros at the upper (lower)-most places. 
% If n>0 (n<0), it moves the contents down (up).
% x is assumed a column vector.
x = x(:);
N = length(x);

if abs(n)<=N
    y = zeros(1,N);
    if n>0
        y = [ zeros(n,1);  x([1:N-n]); ];
    elseif n==0
        y = x;
    elseif n<0
        y = [ x([-n+1:N]);  zeros(-n,1); ];
    end
else
     disp('Error: Shift length should be less than or equal to given vector''s length')
end

Contact us