Matlab

TO PLOT LINEAR CONVOLUTION FOR THE GIVEN FINITE SEQUENCE

linear Convolution Theory:

Convolution is a mathematical way of combining the two signals to form a third signal. It is the only most vital technique in Digital Signal Processing. Using the strategy of impulse decomposition, systems are described by a sign called the impulse response. Convolution is vital because it relates the three signals of interest: the input, the output, and therefore the impulse response. When convolution is used with linear systems. An input, x[n], enters a linear system with an impulse response, h[n], leading to an output, y[n].In equation form: x[n] * h[n] = y[n]. Expressed in words, the input convolved with the impulse response is adequate to the output. Just as addition is represented by the plus, +, and multiplication by the cross, x, convolution is represented by the star, *. The equation represents the linear convolution equation. Zero-padding is used in correlation to avoid mixing of convolution results at the output (due to circular convolution).

x[n] *h[n] = y[n]

Steps for performing linear operation:

  • Give input sequence x[n].
  • Give impulse response sequence h (n):
  • Find the convolution y[n] using the matlab command conv.
  • Plot x[n],h[n],y[n].

Program:

clc;

clear all;

close all;

x1=input(‘Enter the first sequence x1(n) = ‘);

x2=input(‘Enter the second sequence x2(n) = ‘);

L=length(x1);

M=length(x2);

N=L+M-1;

yn=conv(x1,x2);

disp(‘The values of yn are= ‘);

disp(yn);

n1=0:L-1;

subplot(311);

stem(n1,x1);

grid on;

xlabel(‘n1—>’);

ylabel(‘amplitude—>’);

title(‘First sequence’);

n2=0:M-1;

subplot(312);

stem(n2,x2);

grid on;

xlabel(‘n2—>’);

ylabel(‘amplitude—>’);

title(‘Second sequence’);

n3=0:N-1;

subplot(313);

stem(n3,yn);

grid on;

xlabel(‘n3—>’);

ylabel(‘amplitude—>’);

title(‘Convolved output’);

Output:

Enter the first sequence x1(n) = [2 3 5 1]

Enter the second sequence x2(n) = [2 4 2 5 3]

The values of yn are=

     4    14    26    38    35    36    20     3

Rajeshwari Chiluveru

Share
Published by
Rajeshwari Chiluveru

Recent Posts

Google Spam Update 2025: Impact, Recovery Guide & SpamBrain Explained

Google released a spam update on 26th of August 2025 and this is affecting a…

2 weeks ago

Google Experiments with Black Sitelink Colors instead of Blue

Google keeps on testing google search display all the time and this time we are…

1 year ago

What are Template Tags in WordPress? How to Use Template Tags

In wordpress if you are developing new or custom wordpress theme or wordpress plugin then…

2 years ago

Google Search Indexing Issues Started on 31st January to February 2024

If you are experiencing indexing issues of your website then you are not alone and…

2 years ago

Create QR Code for Pages & Post using Plugin in WordPress

On your wordpress website if you want to generate qr code for pages and posts…

2 years ago

Add Google Search Console HTML File Upload on WordPress

If you are trying to verify your WordPress website with google search console with html…

2 years ago