Google Search

Wednesday, December 7, 2011

To develop program for discrete convolution


AIM: - To develop program for discrete convolution

PROGRAM: -

%Program for linear convolution of the sequence x= [1,2] and h= [1,2,4]
clc;
clear all; 
close all;
x=input('enter the 1st sequence');
h=input('enter the 2nd sequence');
y=conv(x,h);
figure;
subplot(3,1,1);
stem(x);
ylabel('Amplitude-->');
xlabel('(a)n-->');
subplot(3,1,2)
stem(h);
ylabel('Amplitude-->');
xlabel('(b)n-->');
subplot(3,1,3)
stem(fliplr(y));
ylabel('Amplitude-->');
xlabel('(c)n-->');
disp('The resultant signal is');y

Output: -

enter the 1st sequence[1 2]
enter the 2nd sequence[1 2 4]
The resultant signal is

y =

     1     4     8     8 


0 comments:

Post a Comment