Untitled

You might also like

Download as txt, pdf, or txt
Download as txt, pdf, or txt
You are on page 1of 1

function olam1() x=input('Enter the long data input sequence x(n)= ) Nsig=length(x)h=input('Enter the filter co-efficients h(n)= ) M=length(h)L=input('Input

the length of each segment=')Nframes=ceil(Nsig/L)Nt=Ns ig+M-1k=1:1:Ntxsig=[x zeros(1,M-1)]subplot(Nframes+2,1,1)stem(k,xsig)y=zeros(1,N t)for m = 0:(Nframes-1)index=m*L+1:min((m+1)*L,Nsig)xm = x(index)xzp=[xm zeros(1 ,M-1)]N=length(xm)+M-1hzp=[h zeros(1,N-M)]H=fft(hzp,N) 4/4/20117

X=fft(xzp,N)Ym=X.*Hym=ifft(Ym,N) %N-point IDFTym=[zeros(1,m*L) ym]ym=[ym zeros(1 ,min(Nsig-(m+1)*L,Nt-length(ym)))]subplot(Nframes+2,1,m+2)stem(k,ym)y=y+ymendsub plot(Nframes+2,1,Nframes+2)stem(k,y)yc=conv(x,h)figure(2)subplot(2,1,1)stem(y)ti tle('Plot of Overlap Add')ylabel('y')xlabel('n')subplot(2,1,2)stem(yc)title('Plo t of Direct Convolution')ylabel('yc')xlabel('n') 4/4/20118

You might also like