Download as txt, pdf, or txt
Download as txt, pdf, or txt
You are on page 1of 1

clc;

clear all;
x=input('enter x(n)');
h=input('enter h(n)');
L=length(x);
M=length(h);
N=L+M-1;
y=zeros(1,N);
x=[x zeros(1,N)];
h=[h zeros(1,N)];
for n=1:1:N
for k=1:1:n
y(n)=(x(k)*h(n-k+1))+y(n);
end
end
subplot(3,1,1);
stem(x);
xlabel('interval');
ylabel('amplitude');
title('input x(n)');
subplot(3,1,2);
stem(h);
xlabel('interval');
ylabel('amplitude');
title('input h(n)');
subplot(3,1,3);
stem(y);
xlabel('interval');
ylabel('amplitude');
title('output y(n)');

You might also like