% Comparison of linear and circular convolution using box
% functions

% Revised 10/18/05 - rms
% Largely fixed (finally!)



[x1a,n]  = stepseq(0,-5,29);
[x1b,n]  =  stepseq(5,-5,29);
x1 = x1a-x1b;
x2 = x1;


% Show the linear convolution

convdemo2(x1,x2,n,5);
pause



n = 1:30;
x = zeros(size(n));
x(1:5) = 1;

% Show 15-point circular convolution of x1 and x2)

N = 15; 

xper = x(1+mod(n-1,N));
stem(n-1,xper)

offset = 5;
nlen = 30;	% length of axis
circconvdemo2a(xper,xper, N, nlen, offset);
pause


% Show 10-point circular convolution of x1 and x2)

N = 10; 

xper = x(1+mod(n-1,N));
stem(n-1,xper)

offset = 5;
nlen = 30;	% length of axis
circconvdemo2a(xper,xper, N, nlen, offset);
pause

% Show 7-point circular convolution of x1 and x2)

N = 7; 

xper = x(1+mod(n-1,N));
stem(n-1,xper)

offset = 5;
nlen = 30;	% length of axis
circconvdemo2a(xper,xper, N, nlen, offset);
pause


	
