Signals & Systems Lab Department of Electrical & Computer Engineering
Lab 03-CLASSES OF SIGNALS
Task 01:
MATLAB Code:
% A
t=-5:0.5:5;
%Define the Function
x1 = (heaviside (t-1)+heaviside(-t+1));
figure;
t_e=0.5* ((x1) + (-x1)); %Even Eqution
stem(t_e); %for plot x1
xlim([-3 25]); ylim([-1 2]);
xlabel('x'); ylabel('y');
title('plot t_e '); grid on;
figure;
t_o=0.5* ((x1)-(-x1)); %Odd Eqution
stem(t_o); %for plot x1
xlim([-3 25]); ylim([-1 2]);
xlabel('x'); ylabel('y');
title('plot t_o '); grid on;
% B
n = -5:0.5:5;
%Define The One Line Command
kr = @(n) double(n == 0);
figure;
%Define the Function
Registration No: FA22-BSEE-035
Signals & Systems Lab Department of Electrical & Computer Engineering
x2 = (kr(n+1) - kr(n-1));
u_e2 = 0.5*( x2 + (-x2)); %Even Eqution
stem(u_e2); %For plot x2
xlim([-3 25]); ylim([-2 2]);
xlabel('x'); ylabel('y');
title('plot u_e2 '); grid on;
figure;
u_o2 = 0.5*( x2 - (-x2)); %Odd Eqution
stem(u_o2); %for Plot x2
xlim([-3 25]); ylim([-2 2]);
xlabel('x'); ylabel('y');
title('plot u_o2'); grid on;
% C
%Define the function
x3 = (cos(t) + sin(t));
figure;
x_e3 = 0.5 .* (x3) + (-x3); %Even Eqution
plot(x_e3); %for plot x3
xlim([-3 25]); ylim([-1 1]);
xlabel('x'); ylabel('y');
title('plot x_e3 '); grid on;
figure;
x_o3 = 0.5 .* (x3) - (-x3); %Odd eqution
plot(x_o3); %For plot x3
xlim([-3 25]); ylim([-2 2])
xlabel('x'); ylabel('y');
title('plot x_o3 '); grid on;
Registration No: FA22-BSEE-035
Signals & Systems Lab Department of Electrical & Computer Engineering
Output:
plot te plot to
2 2
1.5 1.5
1 1
0.5
y
0.5
y
0 0
-0.5 -0.5
-1 -1
0 5 10 15 20 25 0 5 10 15 20 25
x x
Figure 1: Copmute Even and Odd signal
plot ue 2 plot uo 2
2 2
1.5 1.5
1 1
0.5 0.5
0
y
0
y
-0.5 -0.5
-1 -1
-1.5 -1.5
-2 -2
0 5 10 15 20 25 0 5 10 15 20 25
x x
Figure 2: Copmute Even and Odd signal
plot x e3 plot x o 3
1 2
0.8
1.5
0.6
1
0.4
0.2 0.5
0
y
0
y
-0.2
-0.5
-0.4
-1
-0.6
-1.5
-0.8
-1 -2
0 5 10 15 20 25 0 5 10 15 20 25
x x
Figure 3: Copmute Even and Odd signal
Registration No: FA22-BSEE-035
Signals & Systems Lab Department of Electrical & Computer Engineering
Task 02:
MATLAB Code:
syms n N %Define Variables
%Define the function
x1 = 1;
E1 = symsum(x1.^2,n,0,inf) %Energy Eqution
%Power Eqution
P1=limit(1/((2*N)+1)*symsum((x1)^2,n,0,N),N,inf)
%Define the function
x2 = 2.^-n;
E2 = symsum(x2 .^2,n,0,inf) %Energy Eqution
%Power Eqution
P2=limit(1/((2*N)+1)*symsum((x2)^2,n,0,N),N,inf)
Output:
Figure 4: Copmute Energy and Power signal
Lab Analysis:
In this lab we deeply study about how to differentciate between even and odd signals as well
as study by experiments how to find out the power and energy of any signal. We learn about
different types of signal’s and how to compute these signal’s in MATLAB. There are some
types of signal which we learn in S&S lab ‘Periodic & Aperiodic, Causal , Non causal & Anti
causal, Even , Odd & Nither even nor odd, Energy & Power, Deterministic & Stochastic
Signals ’. Inshort we learn some important and use ful commands of matlab.
Registration No: FA22-BSEE-035