Convolution Sum23
Convolution Sum23
Gr No - 1180469
Roll no- 23
Division- B
Batch - B2
Date – 29/09/2019
Problem statement:
Computing linear Convolution graphically and verifying the same using
MATLAB. Also write the C Program or Python Program to find the
convolution
1. Convolution sum
The summation is called the convolution sum of the sequences x[n]
and h[n] and represented compactly as
y[n]=x[n]*h[n]
1.1 Properties -
n Commutative property:
x[n]*h[n] = h[n]*x[n]
n Associative property :
(x[n]*h[n])*y[n]=x[n]*(h[n]* y[n])
Distributive property :
x[n]*(h[n]+y[n])=x[n]*h[n]+x[n]*y[n]
1.2 Interpretation -
1) Time-reverse h[k] to form h[-k]
2) Shift h[-k] to the right by n sampling periods if n > 0 or shift to the
left by n sampling periods if n < 0 to form h[n-k]
3) Form the product v[k]=x[k]h[n-k]
4) Sum all samples of v[k] to develop the n-th sample of y[n] of the
convolution sum
[-2 -4 1 3 1 5 1 -3]
MATLAB Code
clc;
clear all;
x=[1,2,1,2,1,3,2];
h=[1,-1,2,-2,1,1];
subplot(3,1,1);
stem(x);
xlabel('t')
ylabel('x(t)')
title('Original signal')
subplot(3,1,2);
stem(h);
xlabel('t')
ylabel('h(t)')
title('Impulse signal')
subplot(3,1,3);
p=conv(x,h);
stem(p);
xlabel('t')
ylabel('x(t)')
title('Convoultion sum signal')
C code:
#include<stdio.h>
main()
{
float x[15],h[15],y[15];
int i,j,m,n;
printf("enter value for m:");
scanf("%d",&m);
printf("enter value for n:");
scanf("%d",&n);
printf("enter the value of x(n):");
for(i=0;i<m;i++)
{
scanf("%f",&x[i]);
}
printf("enter the value of h(n):");
for(i=0;i<n;i++)
{
scanf("%f",&h[i]);
}
for(i=m;i<=m+n-1;i++)
{
x[i]=0;
}
for(i=n;i<=m+n-1;i++)
{
h[i]=0;
}
for(i=0;i<=m+n-1;i++)
{
y[i]=0;
for(j=0;j<=i;j++)
{
y[i]=y[i]+(x[j]*h[i-j]);
}
}
for(i=0;i<m+n-1;i++)
{
printf("y[%d]=%f\n",i,y[i]);
}
}
Output:
CONCLUSION:
Y[n]=x[n]*h[n]
Thus, by considering the effect of superposition sum on each individual output
sample ,we obtain another very useful way to visualize the calculation of y[n] using
convolution sum. Also the c code of linear convolution sum helps us in solving
different convolution sum problems in studying signals.