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=linadd2(x,h,L)
function y=linadd2(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
      for j=0:N-1
          hj(mod(j+i,N)+1)=short(j+1);
      end
      H=[H,hj'];
  end
  
  inc=N-M+1;
  Q=(N-M+1)*(nfr-1);
  yii=[zeros(1,N+Q)];
  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)];
    for j=0:length(yi)-1
        yj(mod(j+(i-1)*inc,length(yi))+1)=yi(j+1);
    end
    yii=yii+yj;
  end
  y=yii(1:P+M-1);

Contact us