Convolution Properties |commutative property |DISTRIBUTIVE PROPERTY |ASSOCIATIVE PROPERTY| In MATLAB|

 Prove all Convolution Properties by the following, (Use x[n] and h1[n] for Commutative property) 𝒙[𝒏] = 𝟐[𝒖[𝒏 + 𝟐] − 𝒖[𝒏 − 𝟏𝟐]]. And the impulse response is given by, 𝒉𝟏 [𝒏] = 𝟎. 𝟗[𝒖[𝒏 − 𝟐] − 𝒖[𝒏 − 𝟏𝟑]]. 𝒉𝟐 [𝒏] = 𝟎. 𝟒[𝒖[𝒏 + 𝟏𝟐] + 𝒖[𝒏 − 𝟐]].

Source code

t=0:5;% here i use the time 0 to 5

x=2*[heaviside(t+2)-heaviside(t-12)]

h1=0.9*[heaviside(t-2)-heaviside(t-3)]

h2=0.4*[heaviside(t+12)+heaviside(t-2)]

m=length(x);

n=length(h1);

l=length(h2);

a1=m+n-1;

a2=n+l-1;

a3=a2+m-1;

a4=l+a1-1;

a5=m+l-1;

a6=a5+a1-1;

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

b=t:1:t+n-1;

c=t:1:t+l-1;

c1=b+c;

c2=a+b;

c3=a+c1;

c4=c+c2;

c5=a+c;

c6=c2+c5;

d=c2:1:c2+a1-1;

d1=c1:1:c1+a2-1;

d2=c3:1:c3+a3-1;

d3=c4:1:c4+a4-1;

d4=c5:1:c5+a5-1;

d5=d4+d;

%commutative property: x[n]*h1[n]=h1[n]*x[n]

%L.H.S=x[n]*h1[n];

w=conv(x,h1)

subplot(3,2,1)

stem(d,w)

xlabel('Time');

ylabel('Magnitude');

title('commutative property x[n]*h1[n]');

%R.H.S=h1[n]*x[n]

w1=conv(h1,x)

subplot(3,2,2)

stem(d,w1)

xlabel('Time');

ylabel('Magnitude');

title('commutative property h1[n]*x[n]');

%ASSOCIATIVE PROPERTY: x[n]*(h1[n]*h2[n])=(x[n]*(h1[n])*h2[n]

%L.H.S=x[n]*(h1[n]*h2[n])

 w2=conv(h1,h2)   %h1[n]*h2[n]

 w3=conv(x,w2)                %x[n]*(h1[n]*h2[n])

 subplot(3,2,3)

stem(d2,w3)

xlabel('Time');

ylabel('Magnitude');

title('ASSOCIATIVE PROPERTY x[n]*(h1[n]*h2[n])');                

%R.H.S=(x[n]*(h1[n])*h2[n]

w4=conv(w,h2)

subplot(3,2,4)

stem(d3,w4)

xlabel('Time');

ylabel('Magnitude');

title('ASSOCIATIVE PROPERTY (x[n]*(h1[n])*h2[n])');

% DISTRIBUTIVE PROPERTY: x[n]+(h1[n]*h2[n])=x[n]*h1[n]+x[n]*h2[n])

%L.H.S=x[n]+(h1[n]*h2[n])

h3=h1+h2;

w5=conv(x,h3);

subplot(3,2,5)

stem(d5,w5)

xlabel('Time');

ylabel('Magnitude');

title('DISTRIBUTIVE PROPERTY x[n]+(h1[n]*h2[n])'); 

%R.H.S=x[n]*h1[n]+x[n]*h2[n])

 w6=conv(x,h1);                      %x[n]*h1[n]

w7=conv(x,h2);                       %x[n]*h2[n]

w8=w6+w7;

subplot(3,2,6)

stem(d5,w8)

xlabel('Time');

ylabel('Magnitude');

title('DISTRIBUTIVE PROPERTY x[n]*h1[n]+x[n]*h2[n])'); 

 Result:





Post a Comment

0 Comments