Showing posts with label signal and system convolution lab. Show all posts
Showing posts with label signal and system convolution lab. Show all posts

Saturday, 31 May 2014

How to generate DISCRETE TIME CONVOLUTION in matlabs,

DISCRETE TIME CONVOLUTION  
n0=0:20;
x=5*(-0.5).^n0;
n1=-10:5;
h=(2/3).^n;
n2=-20:10;
y1=conv(x,h);
y=y1(1:length(n2));
subplot(3,1,1);
stem(n0,x);
xlabel('time(sampled)');
ylabel('magnitude x(n)');
title('input signal');
grid on;
subplot(3,1,2);
stem(n1,h);
xlabel('time(sampled)');
ylabel('magnitude h(n)');
title('transfer function h(n)');
grid on;
subplot(3,1,3);
stem(n2,y);
xlabel('time(sampled)');
ylabel('magnitude y(n)');
title('output signal');
grid on;