0% found this document useful (0 votes)
35 views7 pages

Convolution Sum23

The document discusses linear convolution, including: 1) Defining convolution sum as y[n]=x[n]*h[n] and its properties of commutativity, associativity, and distributivity. 2) Explaining convolution as time-reversing, shifting, multiplying samples and summing results. 3) Providing a MATLAB and C code example to calculate the convolution of two sequences and plot/print the results.

Uploaded by

high destination
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
35 views7 pages

Convolution Sum23

The document discusses linear convolution, including: 1) Defining convolution sum as y[n]=x[n]*h[n] and its properties of commutativity, associativity, and distributivity. 2) Explaining convolution as time-reversing, shifting, multiplying samples and summing results. 3) Providing a MATLAB and C code example to calculate the convolution of two sequences and plot/print the results.

Uploaded by

high destination
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 7

Siddhant Meshram

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

1.3 Schematic Representation –

▪ The computation of an output sample using the convolution sum is


simply a sum of products which involves fairly simple operations
such as additions, multiplications, and delays.
▪ In practice, if either the input or the impulse response is of finite
length, the convolution sum can be used to compute the output
sample as it involves a finite sum of products.
▪ If both the input sequence and the impulse response sequence are
of finite length, the output sequence is also of finite length.
▪ If both the input sequence and the impulse response sequence are
of infinite length, convolution sum cannot be used to compute the
output
▪ For systems characterized by an infinite impulse response
sequence, an alternate time-domain description involving a finite
sum of products will be considered

Example - Develop the sequence y[n] generated by the convolution of


the sequences x[n] and h[n]:
x[n] = h[n] = δ[n] + δ[n-1] + δ[n-2]

x[n] = h[n] = δ[n] + δ[n-1] + δ[n-2]

y[n]=δ[n] + 2δ[n - 1] + 3δ[n - 2] + 2δ [n - 3] + δ[n-4]

In general, if the lengths of the two sequences being convolved are M


and N, then the sequence generated by the convolution is of length
M+N-1
The M-file conv implements the convolution sum of two finite-length
sequences
If a= [-2 0 1 -1 3]
b= [1 2 0 -1]
then conv(a,b) yields

[-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.

You might also like