Code covered by the BSD License  

Highlights from
EC1302 DSP Lab

EC1302 DSP Lab

by

 

These are matlab code for experiments in the course EC1302 DSP Lab.

y=linadd(x,h,L)
%y=linadd(x,h,L) returns linear convolution between 
%                a long sequence x and a short sequence h
%                using overlap-add method with a segment length, L
function y=linadd(x,h,L)
P=length(x);
M=length(h);

R=rem(P,L);
if (R ~= 0)
    long=[x,zeros(1,L-R)];
else
    long=x;
end

nfr=length(long)/L;
  
N=L+M-1;
short=[h,zeros(1,N-M)];
    
H=[];
for i=0:N-1
    H=[H,(shift(short,i))'];
end
  
inc=N-M+1;
Q=(N-M+1)*(nfr-1);
yii=[zeros(N+Q,1)];
for i=1:nfr
    xi=long((1+(i-1)*L):(L+(i-1)*L));
    xi=[xi,zeros(1,N-L)];
    yi=[H*xi';zeros(Q,1)];
    yii=yii+(shift(yi,(i-1)*inc))';
end
y=yii(1:P+M-1)';

Contact us