You are on page 1of 5

PRACTICAL 3

NAME-MUKESH KUMAR RATHOUR


ROLL NO-18MC0055
M.Sc Tech
1. Consider the following formula for a discrete signal

Find the rest of the sequence for 0 < n < 100 and plot it using the MATLAB
function stem.

CODE:

n = 0:99;
x = 0:99;
j = n+1;
x0 = 0;
x1 = 1;
x2 = 2;

for i = j
if i == 1
x(i) = x0;
elseif i == 2
x(i) = x1;
elseif i == 3
x(i) = x2;
else
x(i) = x(i-1) + x(i-3);
end
end
figure(1)
stem(n,x)

title('Plot of x[n] vs n')


xlabel('n')
ylabel('x[n]')
OUTPUT:
2. Given the discrete signal x[n ] = 0.5nu[n]
(a) Use MATLAB to plot the signal x x[ [n n ] for n = - - 5 to 200.
(b) Is this a finite energy discrete time signal? Use the following result

(c) Verify your results by using symbolic MATLAB to find an


expression for the above sum.

CODE:
n = -5:200;
x = n;

for i = 1:length(n)
if (n(i)< 0)
u(i) = 0;
else
u(i) = 1;
end
end

for i = 1: length(n)
x(i) = 0.5^(n(i))*u(i);
end

figure(2)
stem(n,x)
title('Plot of x[n] vs n')
xlabel('n')
ylabel('x[n]')

%To calculate energy of the signal

syms k n a
Energy = symsum(0.5^n,n,0,inf)

%verifying result using symbolic mathematics


Energy = symsum(a^n,n,0,inf)
OUTPUT:

• Energy of the signal = 2


• Since the Energy of the signal is finite. So, the given signal is
Energy signal.
• Using symbolic MATLAB, we get,

Energy = piecewise(1 <= a, Inf, abs(a) < 1, -


1/(a - 1))

You might also like