Professional Documents
Culture Documents
Grade: -
Signature of Faculty: -
Theory –
Convolution Theorem
Figure 2.3 (a) The impulse response h[n] of an LTI system and an
input x[n] to the system; (b) the responses or "echoes," 0.5h[n] and
2h[n - 1], to the nonzero values of the input, namely, x[O] = 0.5 and
x[1] = 2; (c) the overall response y[n], which is the sum of the echoes
in (b).
MATLAB code for example 2.1
clc
clear all
close all
n1=input('Enter the time sample range of x : ');
x=input('\nEnter the sequence : ');
n2=input('\nEnter the time sample range of y : ');
y=input ('\nEnter the sequence : ');
u=min(min(n1),min(n2));
t=max(max(n1),max(n2));
r=u:1:t;
z1=[];
temp=1;
for i=1:length(r)
if(r(i)<min(n1) || r(i)>max(n1))
z1=[z1 0];
else
z1=[z1 x(temp)];
temp=temp+1;
end
end
z2=[];
temp=1;
for i=1:length(r)
if(r(i)<min(n2) || r(i)>max(n2))
z2=[z2 0];
else
z2=[z2 y(temp)];
temp=temp+1;
end
end
z=z1+z2;
subplot(3,1,1);
stem(r,z1);
subplot(3,1,2);
stem(r,z2);
subplot(3,1,3);
stem(r,z);
Commands
x=[0 0 0.5 2 0 0 0]
n=[-2 -1 0 1 2 3 4]
figure(1)
stem(n,x)
x=[1 1 1 0 0 0]
n=[-2 -1 0 1 2 3 ]
figure(2)
stem(n,x)
x=[0 1 1 1 0 0 ]
n=[-2 -1 0 1 2 3 ]
figure(3)
stem(n,x)
x=[0 0 1 1 1 0 ]
n=[-2 -1 0 1 2 3 ]
figure(3)
stem(n,x)
x=[0 0 0 1 1 1 ]
n=[-2 -1 0 1 2 3 ]
figure(4)
stem(n,x)
Output:
FIGURE 1-
FIGURE 2-
FIGURE 3-
FIGURE 4-
Example 2.3 -
MATLAB code example 2.3
t=-2:1:2;
y=[zeros(1,2), ones(1,1), zeros(1,2)];
subplot(2,2,1);
stem(t,y);
ylabel('d(n)');
xlabel('unit impulse');
Commands
Enter n values :
100 ////////// MIS MULTPLIED BY 100.
Enter n values :
100 ////////// MIS MULTPLIED BY 100.
Enter a value :
16
Output-
Conclusion -
With the help of MATLAB code and outputs we
have generated and analyzed different types of
analog signals and discreate sequences.