Discrete-time convolution sum | In MATLAB|

 Convolve the following signals if the input of the system be given by, 𝒙[𝒏] = 𝟐[𝒖[𝒏 + 𝟐] − 𝒖[𝒏 − 𝟏𝟐]]. And the impulse response is given by, 𝒉[𝒏] = 𝟎. 𝟗[𝒖[𝒏 − 𝟐] − 𝒖[𝒏 − 𝟏𝟑]]

CODE:

clc;

clear all;

close all;

t=-15:15;

x1=[zeros(1,13) ones(1,18)];

x2=[zeros(1,27) ones(1,4)];

x3=x1-x2;

x=2*x3;

h1=[zeros(1,18) ones(1,13)];

h2=[zeros(1,29) ones(1,2)];

h3=h1-h2;

=0.9*h3;

l1=length(x);

l2=length(h);

l3=l1+l2-1;

a=t:1:t+l1-1;

b=t:1:

t+l2-1;

c=a+b;

d=c:1:c+l3-1;

y=conv(x,h);

subplot(3,1,1);

stem(a,x);

xlabel('Time');

ylabel('Magnitude');

title('x[n]');

subplot(3,1,2);

stem(b,h);

xlabel('Time');

ylabel('Magnitude');

title('h[n]');

subplot(3,1,3);

stem(d,y);

xlabel('Time');

ylabel('Magnitude');

title('x[n]*h[n]');




Post a Comment

0 Comments