Overlap Add Method1

You might also like

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

EXPT.

NO: 1

FAST CONVOLUTION

12-6-2013

OVERLAP ADD METHOD:


Coding:
clc;
clear all;
x=input('enter the input signal x[n]');
user

%getting the inputs from the

h=input('enter the value for h[n]');


b=input('enter the no. of samples in first block');
length
n=0:1:length(x)-1;
x

%to get the input of block


%to find the length of

subplot(3,1,1);
stem(n,x)
n=0:1:length(h)-1;
h

%to find the length of

subplot(3,1,2);
stem(n,h)
x1=[x(1:b) zeros(1,length(h)-1)];
appending zeros

%spliting blocks and

x2=[x(b+1:length(x)) zeros(1,length(h)-1)];
y1=convol(x1,h);
convolution function

%calling

y2=convol(x2,h);
c=length(y1);
d=length(y2);
y2=[zeros(1,c-length(h)+1) y2];
matrices of same size
y1=[y1 zeros(1, d-length(h)+1)];
y=y1+y2;
disp(y)

%adding zeros to make both

n=0:1:length(y)-1;
subplot(3,1,3);
stem(n,y)
Execution:
enter the input signal x[n]
3
2
1]

[1

enter the value for h[n]

[1 2 1]

enter the number of samples in first block 8


x1
1

X2
1

Y1
14

14

12

14

15

15

Y2

y=
1

You might also like