Matlab Coding Spl-1
Matlab Coding Spl-1
Matlab Coding Spl-1
X(t+T)=x(t) all t
y=cos(2*t+pi/4)
xlabel('TIME----------->>')
ylabel('y(t)=cos(2*t+pi/4)')
0.8
0.6
0.4
0.2
y (t )
-0.2
-0.4
-0.6
-0.8
-1
0 5 10 15 20 25 30
time
0.8
0.6
0.4
0.2
y (n )
-0.2
-0.4
-0.6
-0.8
-1
0 5 10 15 20 25 30
time
U(t)= 1 t>0
0 t<0
U(n)= 1 n>=0
0 n<0
Coding:-
t1=0:5:50
t2=-50:5:0
y1=ones(size(t1))
y2=zeros(size(t2))
t=[t2 t1]
y=[y2 y1]
plot(t,y)
xlabel('t')
title('cont. unit step')
cont. unit step
1
0.9
0.8
0.7
0.6
0.5
0.4
0.3
0.2
0.1
0
-50 -40 -30 -20 -10 0 10 20 30 40 50
t
Coding:-
n1=0:5:30
n2=-50:5:0
y1=ones(size(n1))
y2=zeros(size(n2))
n=[n2 n1]
y=[y2 y1]
stem(n,y)
xlabel('n')
title('discrete unit step')
discrete unit step
1
0.9
0.8
0.7
0.6
0.5
0.4
0.3
0.2
0.1
0
-50 -40 -30 -20 -10 0 10 20 30
n
EXPERIMENT NO:4
Theory:
Convolution theorem for continuous system:
If the impulse response of an
analog or continuous time system be h(t), it means that for an input δ(t) its
output is h(t). Hence for all linear system its output for a shifted impulse
δ(t-T) is h(t-T). The following are the mathematical representation of these
operations:
δ(t) h(t)
δ(t-T) h(t-T)
x(t) δ(t-T) x(T) h(t-T)
∫ x(T) δ(t-T) dT ∫ x(T) h(t-T) dT
From the last two statements, we can say that an input x(T) δ(t-T) the output
is x(T) h(t-T) and for an input of continuous summation or integration of
x(T) δ(t-T), the output is also continuous summation of x(T) h(t-T).
Therefore, we can write by the linearity of the system
y(t)= ∫ x(T) h(t-T) dT
The right hand side of the above equation is defined as convolution of x(t)
with h(t) and now we can write it as follow:
y(t)= convolution of x(t) and h(t)
= x(t) * h(t)
= ∫ x(T) h(t-T) dT
The symbol ‘*’ stands for convolution.
Coding:
Continuous convolution time system:
t1=[-10:1:0];
t2=[0:1:2];
t3=[2:1:10];
x=zeros(size(t1));
y=ones(size(t2));
z=zeros(size(t3));
t=[t1,t2,t3];
a=[x,y,z];
subplot(2,2 ,1);
plot(t,a,'m');
xlabel('time-->');
ylabel('u(t)-u(t-2)');
u1=[-11:1:0];
u2=[0:1:3];
u3=[3:1:11];
v1=zeros(size(u1));
v2=ones(size(u2));
v3=zeros(size(u3));
u=[u1,u2,u3];
b=[v1,v2,v3];
subplot(2,2,2);
plot(u,b,'m')
xlabel('time-->');
ylabel('u(t)-u(t-3)');
c=conv(y,v2);
subplot(2,2,3);
plot(c);
xlabel('time-->');
ylabel('(u(t)-u(t-2))*(u(t)-u(t-3))');
1 1
0.8 0.8
0.6 0.6
u(t)-u(t-3)
u(t)-u(t-2)
0.4 0.4
0.2 0.2
0 0
-10 -5 0 5 10 -15 -10 -5 0 5 10 15
time--> time-->
2.5
(u(t)-u(t-2))*(u(t)-u(t-3))
1.5
1
1 2 3 4 5 6
time-->