Professional Documents
Culture Documents
Aim:
1) To plot a continuous and discrete function and find energy and power of a
function
2) Find convolution of discrete functions
Theory: Discuss about signal energy and power and discreet convolution.
Program 01:
1. Generate signal exp(-t).*cos(2*pi*t) and combined operation
2. Generate unit step u(t) and flip operation
3. Generate signal exp(-t)*(u(t) - u(t-1)) and find signal energy
% Generate signal exp(-t).*cos(2*pi*t) and combined operation.
f = @(t)exp(-t).*cos(2*pi*t).*(t>=0)
t = -2:0.01:2;
subplot(2,2,1)
plot(t,f(t))
subplot(2,2,2)
plot(t,f(2*t+1))
% Generate unit step u(t) and flip operation
u = @(t)t>=0
subplot(2,2,3)
plot(t,u(t))
axis ([-1 2 -.1 1.1]);
subplot(2,2,4)
plot(t,u(-t))
axis ([-1 2 -.1 1.1]);
% Generate signal exp(-t)*(u(t) - u(t-1))
g = @(t)exp(-t).*(t>=0 & t<1)
% Signal Energy
E = sum(g(t).*g(t)*0.01)
figure(2)
plot(t,g(t))
Exercise:
1. Generate a ramp function in the time range [0,1] and find its energy.
2. Generate a function
t 0<t< 1
x ( t )=1 1< t<2
2 2< t<3
1 n ( ) 1 n
u n
u(n)
2
4
()
()
h1 = h(n)
x1 = double(x1)
h1 = double(h1)
size(h1)
size(x1)
y = conv2(h1, x1);
figure(2)
stem(y)
Exercise
1. Find u[n]*u[n]
2. Find convolution of sin(pi*n/3) and n*u[n]