MATLAB program to perform linear convolution of two signals ( without using MATLAB function)

Program Code
clc;
close all;
clear all;
xt=input('Please enter the input sequence in time domain x[n]= ');
lxt=length(xt);
ht=input('Please enter the impulse sequence h[n]= ');
lht=length(ht);
ext=[xt zeros(1,(lht-1))];
eht=[ht zeros(1,(lxt-1))];
xdft=fft(ext);
hdft=fft(eht);
freqm=xdft.*hdft;
yt=[ifft(freqm)];
display('The convoluted sequence is given below');
disp(yt);
subplot(311);
stem(xt);
xlabel('Time');
ylabel('Magnitude');
title('Input sequence x[n]');
subplot(312);
stem(xt);
xlabel('Time');
ylabel('Magnitude');
title('Input sequence 1');
subplot(313);
stem(yt);
xlabel('Time');
ylabel('Magnitude');
title('Convoluted sequence');


Example of Output
Please enter the input sequence in time domain x[n]= [1 2 3 4 5 6]
Please enter the impulse sequence h[n]= [1 2 3 4 5 6]
The convoluted sequence is given below
  Columns 1 through 5 

    1.0000    4.0000   10.0000   20.0000   35.0000

  Columns 6 through 10 

   56.0000   70.0000   76.0000   73.0000   60.0000

  Column 11 

   36.0000



4 comments:

  1. This design is sⲣectacular! You certainly know how to
    ҝeep a reader entertained. Between yoսr wit and your videos, I
    was almost moved to start my own blog (well, aⅼmost...HaHa!) Ꮐreat job.

    I really enjoүed what you һad to say, and more than that,
    how you presented it. T᧐o ϲool!

    ReplyDelete
    Replies
    1. Respected Sir,
      Thank you. I am greatly obliged to you. I wish you, your family and all your friends, happiness, good health and success in life. My name is Anju K. Please tell me your name.

      Delete
  2. Wonderfuⅼ beat ! I would like to apprentice even as you amend your web site, how can i subscribe for a weƄlog site?
    The account һеlped me а appropriate deɑl.
    I have Ƅeen a little bit acquainted of this your broadcast offered brilliant clear concept

    ReplyDelete
    Replies
    1. Respected Sir,
      Thank you. I am greatly obliged to you. I wish you, your family and all your friends, happiness, good health and success in life. My name is Anju K. Please tell me your name.

      Delete

Please write your opinion about this MATLAB program here, only in English.