0% found this document useful (0 votes)
18 views110 pages

BS LAB Recent

Uploaded by

Sathwik M
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
18 views110 pages

BS LAB Recent

Uploaded by

Sathwik M
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 110

Std.

Id:23011MB605
2024-25

DATE OF
S.NO NAME OF THE EXPERIMENT PAGE.NO REMARK
EXPERIMENT

BASIC OPERATIONS ON
1. 03-08 21-08-2024
MATRICES

GENERATION OF SIGNALS USING


2. 09-15 28-08-2024
MATLAB INBUILT FUNCTIONS

GENERATION OF SIGNALS USING


3. LOOPS & CONDITIONAL 16-23 04-09-2024
STATEMENT

GENERATION OF SIGNALS USING


4. 24-29 11-09-2024
TIME BASIS EQUATION

BASIC ARITHMETIC OPERATIONS


5. 30-34 18-09-2024
ON SIGNALS AND SEQUENCES

SCALING OPERATIONS ON
6. 35-39 18-09-2024
SIGNALS AND SEQUENCES

SHIFTING & FOLDING


7. OPERATIONS ON SIGNALS AND 40-45 25-09-2024
SEQUENCES

FINDING REAL AND IMAINARY


8. 46-48 25-09-2024
PART OF SIGNALS

FINDING EVEN AND ODD


9. 49-52 25-09-2024
COMPONENTS OF SIGNALS

VERIFICATION OF SAMPLING
10. 53-56 02-10-2024
THEOREM

VERIFICATION OF GIBBS
11. 57-59 02-10-2024
PHENOMENON

BS LAB 1 ECE-CEH-JNTUH
Std.Id:23011MB605
2024-25

12. CONVOLUTION OF SIGNALS 60-64 09-10-2024

VERIFICATION OF LINEARITY OF
13. 65-68 09-10-2024
A SYSTEM

AUTOCORRELATION &
14. 69-71 16-10-2024
CROSSCORRELATION OF SIGNAL

GENERATION OF GAUSSIAN
15. NOISE AND EXTRACTING 72-74 23-10-2024
ITS PARAMETERS

FINDING UNIT STEP, UNIT


16. IMPULSE, SINE WAVE RESPONSE 75-77 30-10-2024
OF A LTI SYSTEM

ENERGY AND POWER OF A


17. SIGNAL & SIGNAL 78-84 06-11-2024
CLASSIFICATION

FOURIER TRANSFORM OF
SIGNAL AND PLOTTING
18. 85-93 13-11-2024
MAGNITUDE AND PHASE
RESPONSE

LAPLACE TRANSFORM OF
19. SIGNAL AND PLOTTING 94-99 10-02-2022
ZERO’S & POLES

Z – TRANSFORM OF SIGNAL
20. AND PLOTTING LOCATION OF 100-105 16-02-2022
ZERO’S & POLES

BS LAB 2 ECE-CEH-JNTUH
Std.Id:23011MB605
2024-25

Experiment No:1 Date:

Name of the Experiment: Basic Operations on Matrices

Number of Programs: 1

Aim:
To perform the basic operations on matrices and to get the output.

Software Required:
MATLAB.

Theory:
MATLAB treats all variables as matrices. Vectors are special forms of matrices and contain
only one row or one column. Whereas scalars are special forms of matrices and contain only
one row and one column. A matrix with one row is called row vector and a matrix with single
column is called column vector.
Some of convenient matrix building functions are as follows:
⮚ A+B:Performs Addition of Matrices.
⮚ A-B: Performs Subtraction of Matrices.
⮚ A*B: Performs Multiplication of Matrices.
⮚ A/B: Performs Division of Matrices.
⮚ A.*B: Performs Element Wise Multiplication of Matrices.
⮚ A./B: Performs Element Wise Division of Matrices.
⮚ cat(x,A,B):Performs Concatination of Matrices(x is the Dimension of matrices).
⮚ Selection:Selects a sub matrix or row or column of a matrix.
⮚ Deletion: Delets a sub matrix or row or column of a matrix.
⮚ length(A):Gives length of a Matrix.
⮚ size(A): Gives size of a Matrix.
⮚ rank(A): Gives rank of a Matrix.
⮚ det(A): Gives Determinant of a Matrix.
⮚ eig(A): Gives Eigen values of a Matrix.
⮚ trace(A): Gives trace of a Matrix.
⮚ diag(A): Gives diagonal elements of a Matrix.
⮚ inv(A): Gives Inverse of a Matrix.
⮚ transpose(A): Gives transpose of a Matrix.

Procedure:
⮚ Switch on the system with MATLAB tool.
⮚ Launch MATLAB software by clicking on MATLAB icon on the desktop.
⮚ Create new program from NEW option in FILE menu.
⮚ Write the program in TEXT EDITOR window.
⮚ Save the program with .m extension.
⮚ Run the program from the EDITOR menu or by pressing F5.

BS LAB 3 ECE-CEH-JNTUH
Std.Id:23011MB605
2024-25

⮚ Check the COMMAND window for output values/errors.If any errors are there,debug the
errors,modify the program,and go to step 6.
⮚ Observe the text outputs in command window and graphical outputs in FIGURES.
⮚ Close the MATLAB tool properly.
⮚ Switch off the system.

Program:
clc;
clear all;
close all;
A=[ 1 , 2 , 3 ; 4 , 5 , 6 ; 7 , 8 , 9]
B=[ 3 , 2 , 1 ; 6 , 5 , 4 ; 9 , 8 , 7]
m_sum=A+B
m_diff=A-B
m_mul=A*B
m_div=A/B
m_mulE=A.*B
m_divE=A./B
m_len=length(A)
m_siz=size(A)
m_rnk=rank(A)
m_det=det(A)
m_eig=eig(A)
m_trc=trace(A)
m_dgm=diag(A)
m_dg1=diag(A,1)
m_dg2=diag(A,2)
m_inv=inv(A)
m_trp=transpose(A)
m_cat_1=cat(1,A,B)
m_cat_2=cat(2,A,B)
m_del_1=A(:,:,1)
m_del_r=A(2,:)
m_del_c=A(:,3)
m_sel_1=A(1:2 , 2:3)
m_sel_r=A(2,:)
m_sel_c=A(:,3)

Output:
A=

1 2 3

4 5 6

7 8 9

B=

BS LAB 4 ECE-CEH-JNTUH
Std.Id:23011MB605
2024-25

3 2 1

6 5 4

9 8 7

m_sum =

4 4 4

10 10 10

16 16 16

m_diff =

-2 0 2

-2 0 2

-2 0 2

m_mul =

42 36 30

96 81 66

150 126 102

Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND =
2.312965e-18.

> In EXP (line 10)

m_div =

-2.7222 2.1111 -0.3889

-3.1389 1.9444 0.1944

-3.5556 1.7778 0.7778

m_mulE =

3 4 3

24 25 24

63 64 63

m_divE =

0.3333 1.0000 3.0000

BS LAB 5 ECE-CEH-JNTUH
Std.Id:23011MB605
2024-25

0.6667 1.0000 1.5000

0.7778 1.0000 1.2857

m_len =

m_siz =

3 3

m_rnk =

m_det =

-9.5162e-16

m_eig =

16.1168

-1.1168

-0.0000

m_trc =

15

m_dgm =

m_dg1 =

m_dg2 =

Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND =
2.202823e-18.

BS LAB 6 ECE-CEH-JNTUH
Std.Id:23011MB605
2024-25

> In EXP (line 23)

m_inv =

1.0e+16 *

0.3153 -0.6305 0.3153

-0.6305 1.2610 -0.6305

0.3153 -0.6305 0.3153

m_trp =

1 4 7

2 5 8

3 6 9

m_cat_1 =

1 2 3

4 5 6

7 8 9

3 2 1

6 5 4

9 8 7

m_cat_2 =

1 2 3 3 2 1

4 5 6 6 5 4

7 8 9 9 8 7

m_del_1 =

1 2 3

4 5 6

7 8 9

m_del_r =

BS LAB 7 ECE-CEH-JNTUH
Std.Id:23011MB605
2024-25

4 5 6

m_del_c =

m_sel_1 =

2 3

5 6

m_sel_r =

4 5 6

m_sel_c =

Result:
Hence the basic operations on matrices have been performed.

BS LAB 8 ECE-CEH-JNTUH
Std.Id:23011MB605
2024-25

Experiment No:2 Date:

Name of the Experiment: Generation of various signals using


MATLAB inbuilt functions

Number of Programs: 9

Aim:
To generate different types of signals by using MATLAB inbuilt functions and to observe the
output.

Software Required:
MATLAB.

Theory:
Functions that are frequently used or that can take more time to execute are often implemented as
executable files. These functions are called built-ins.

Unlike MATLAB program file functions, you cannot see the source code for built-ins. Although
most built-in functions do have a program file associated with them, this file is there mainly to
supply the help documentation for the function.

Functions that are frequently used or that can take more time to execute are often implemented as
executable files. These functions are called built-ins.

Unlike MATLAB program file functions, you cannot see the source code for built-ins. Although
most built-in functions do have a program file associated with them, this file is there mainly to
supply the help documentation for the function.

If the amplitude of the signal is defined at every instant of time then it is called
continuous time signal. If the amplitude of the signal is defined at only at some instants
of
time then it is called discrete time signal. If the signal repeats itself at regular intervals then it
is called periodic signal. Otherwise they are called aperiodic signals.

EX: ramp,Impulse,unit step, sinc- Aperiodic signals


square,sawtooth,triangular sinusoidal – periodic signals.

Ramp signal: The ramp function is a unitary real function, easily computable as the mean of
the independent variable and its absolute value.This function is applied in engineering. The
name ramp function is derived from the appearance of its graph.
r(t)= t
Unit impulse signal: One of the more useful functions in the study of linear systems is the
"unit impulse function."An ideal impulse function is a function that is zero everywhere but at
the origin, where it isinfinitely high. However, the area of the impulse is finite
Y(t)= 1 when t=0
= 0 other wise
Unit step signal: The unit step function and the impulse function are considered to be
fundamental functions in engineering, and it is strongly recommended that the reader
becomes very familiar with both of these functions.
BS LAB 9 ECE-CEH-JNTUH
2021-22 Std.Id:20011A0403

u(t)= 0 if t < 0
=1 if t > 0
=1/2 if t=0
Sinc signal: There is a particular form that appears so frequently in communications
engineering, that we give it its own name. This function is called the "Sinc function”.
The Sinc function is defined in the following manner:
Sinc(x) =1 if x=0
Sinc(x)=(sin(pi*x))/(pi*x) else

Procedure:
⮚ Switch on the system with MATLAB tool.
⮚ Launch MATLAB software by clicking on MATLAB icon on the desktop.
⮚ Create new program from NEW option in FILE menu.
⮚ Write the program in TEXT EDITOR window.
⮚ Save the program with .m extension.
⮚ Run the program from the EDITOR menu or by pressing F5.
⮚ Check the COMMAND window for output values/errors.If any errors are there,debug the
errors,modify the program,and go to step 6.
⮚ Observe the text outputs in command window and graphical outputs in FIGURES.
⮚ Close the MATLAB tool properly.
⮚ Switch off the system.

Program-1:Generation of sine wave using MATLAB inbuilt function


clc
clear all
close all
f=0.01;
t=0:1:100;
y=sin(2*pi*f*t);
plot(t,y);
title('sine wave');
xlabel('time');
ylabel('amplitude');
grid on;

Output-1:

BS LAB 10 ECE-CEH-JNTUH
2021-22 Std.Id:20011A0403

Program-2:Generation of cos wave using MATLAB inbuilt function


clc
clear all
close all
f=0.01;
t=0:1:100;
y=cos(2*pi*f*t);
plot(t,y);
title('cos wave');
xlabel('time');
ylabel('amplitude');
grid on;

Output-2:

Program-3:Generation of square wave using MATLAB inbuilt function


clc
clear all
close all
t=1:0.0001:10;
y=square(t);
plot(t,y); axis([0,11,-3,3]);
title('square wave');
xlabel('time');
ylabel('amplitude');
grid on;

Output-3:

BS LAB 11 ECE-CEH-JNTUH
2021-22 Std.Id:20011A0403

Program-4:Generation of sawtooth signal using MATLAB inbuilt function


clc
clear all
close all
t=0:0.01:20;
y=sawtooth(t);
plot(t,y);
title('sawtooth signal');
xlabel('time');
ylabel('amplitude');
grid on;

Output-4:

Program-5:Generation of ramp signal using MATLAB inbuilt function


clc
clear all
close all
t=0:0.01:10;
y=t;
plot(t,y);
title('ramp signal');
xlabel('time');
ylabel('amplitude');
grid on;

BS LAB 12 ECE-CEH-JNTUH
2021-22 Std.Id:20011A0403

Output-5:

Program-6:Generation of exponential signal using MATLAB inbuilt function


clc
clear all
close all
t=-10:0.01:10;
y=exp(2*t);
plot(t,y);
title('Exponential Signal');
xlabel('time');
ylabel('amplitude');
grid on;

Output-6:

Program-7:Generation of unit step signal using MATLAB inbuilt function


clc;
clear all;
close all;
t=-10:0.01:10;
y=[zeros(1,1000),ones(1,1001)];
plot(t,y);
axis([-12,12,-2,2]);
title('Unit Step
Signal'); xlabel('time');
ylabel('amplitude');
grid on;

BS LAB 13 ECE-CEH-JNTUH
2021-22 Std.Id:20011A0403

Output-7:

Program-8:Generation of unit impulse signal using MATLAB inbuilt function


clc;
clear all;
close all;
t=-10:0.01:10;
y=[zeros(1,1000),ones(1,1),zeros(1,1000)];
plot(t,y);
axis([-12,12,-2,2]);
title('Unit Impulse Signal');
xlabel('time');
ylabel('amplitude');
grid on;

Output-8:

Program-9:Generation of sinc signal using MATLAB inbuilt function


clc
clear all
close all
f=0.01;
t=-10:0.001:10;
y=sin(pi*t)./(pi*t);
plot(t,y);
title('Sinc Signal');
xlabel('time');
ylabel('amplitude');

BS LAB 14 ECE-CEH-JNTUH
2021-22 Std.Id:20011A0403

grid on;

Output-9:

Result:
Hence the different types of signals by using MATLAB inbuilt functions are generated and
output is observed.

BS LAB 15 ECE-CEH-JNTUH
2021-22 Std.Id:20011A0403

Experiment No:3 Date:

Name of the Experiment: Generation of various signals using


LOOPS and CONDITIONAL Statements

Number of Programs:8

Aim:
To generate different types of signals by using Loops and Conditional Statements and to
observe the output.

Software Required:
MATLAB.

Theory:
Loops and Conditional Statements
Control flow and branching using keywords, such as if, for, and while.

MATLAB Language Syntax

if, elseif, else Execute statements if condition is true

for for loop to repeat specified number of times

parfor Parallel for loop

switch, case,

otherwise Execute one of several groups of statements

try, catch Execute statements and catch resulting errors

while while loop to repeat when condition is true

break Terminate execution of for or while loop

continue Pass control to next iteration of for or while loop

end Terminate block of code, or indicate last array index

pause Stop MATLAB execution temporarily

return Return control to invoking function

Conditional Statements

To determine which block of code to execute at run time, use if or switch conditional statements.

Loop Control Statements

To repeatedly execute a block of code, use for and while loops.

BS LAB 16 ECE-CEH-JNTUH
2021-22 Std.Id:20011A0403

Procedure:
⮚ Switch on the system with MATLAB tool.
⮚ Launch MATLAB software by clicking on MATLAB icon on the desktop.
⮚ Create new program from NEW option in FILE menu.
⮚ Write the program in TEXT EDITOR window.
⮚ Save the program with .m extension.
⮚ Run the program from the EDITOR menu or by pressing F5.
⮚ Check the COMMAND window for output values/errors.If any errors are there,debug the
errors,modify the program,and go to step 6.
⮚ Observe the text outputs in command window and graphical outputs in FIGURES.
⮚ Close the MATLAB tool properly.
⮚ Switch off the system.

Program-1:Generation of unit step using Loops:


clc;
close all;
clear all;
t=-10:0.01:10;
for i=1:1:length(t)
if(t(i)>0)
y(i)=1;
else
y(i)=0;
end
end
plot(t,y);
axis([-12,12,-2,2]);
title('Unit Step Signal using Loops');
xlabel('time');
ylabel('amplitude');
grid on;

Output-1:

BS LAB 17 ECE-CEH-JNTUH
2021-22 Std.Id:20011A0403

Program-2:Generation of unit impulse signal using loops:


clc;
close all;
clear all;
t=-10:0.01:10;
for i=1:1:length(t)
if(t(i)==0)
y(i)=2;
else
y(i)=1;
end
end
plot(t,y);
axis([-12,12,0,3]);
title('Unit Impulse Signal using Loops');
xlabel('time');
ylabel('amplitude');
grid on;

Output-2:

Program-3:Generation of square wave using Loops:


clc;
close all;

BS LAB 18 ECE-CEH-JNTUH
2021-22 Std.Id:20011A0403

clear all;
t=2:0.01:10;
for i=1:1:length(t)
if(t(i)<4)
y(i)=0;
else if(t(i)<6)
y(i)=1;
else if(t(i)<8)
y(i)=0;
else
y(i)=1;
end
end
end
end
plot(t,y);
axis([0,12,-2,3]);
title('Square Wave using
Loops'); xlabel('time');
ylabel('amplitude');
grid on;

Output-3:

Program-4:Generation of triangular wave using Loops:


clc;
close all;
clear all;
t=0:0.01:8;
for i=1:1:length(t)
if(t(i)<2)
y(i)=t(i);
else if(t(i)<6)
y(i)=-t(i)+4;
else
y(i)=t(i)-8;
end
end
end

BS LAB 19 ECE-CEH-JNTUH
2021-22 Std.Id:20011A0403

plot(t,y);
axis([-2,10,-3,3]);
title('Triangular Wave using Loops');
xlabel('time');

Output-4:

Program-5:Generation of ramp signal using Loops:


clc;
close all;
clear all;
t=-10:0.01:10;
for i=1:1:length(t)
y(i)=t(i);
end
plot(t,y);
title('Ramp Signal using
Loops'); xlabel('time');
ylabel('amplitude');
grid on;

Output-5:

BS LAB 20 ECE-CEH-JNTUH
2021-22 Std.Id:20011A0403

Program-6:Generation of exponential signal using Loops:


clc;
close all;
clear all;
t=-10:0.01:10;
for i=1:1:length(t)
y(i)=exp(2*t(i));
end
plot(t,y);
title('Exponential Signal using Loops');
xlabel('time');
ylabel('amplitude');
grid on;

Output-6:

Program-7:Generation of unit step signal using Loops:


clc;
close all;
clear all;
t=-10:0.01:10;
for i=1:1:length(t)
y(i)=sin(pi*t(i))./(pi*t(i));
end

BS LAB 21 ECE-CEH-JNTUH
2021-22 Std.Id:20011A0403

plot(t,y);
title('Sinc Signal using Loops');
xlabel('time');
ylabel('amplitude');
grid on;

Output-7:

Program-8:Generation of unit impulse signal using Loops:


clc;
close all;
clear all;
t=-10:0.01:10;
for i=1:1:length(t)
y(i)=t(i).^2;
end
plot(t,y);
axis([-12,12,0,100]);
title('Parabola using Loops');
xlabel('time');
ylabel('amplitude');
grid on;

Output-8:

BS LAB 22 ECE-CEH-JNTUH
2021-22 Std.Id:20011A0403

Result:
Hence the different types of signals by using Loops and Conditional statements are generated
and output is observed.

BS LAB 23 ECE-CEH-JNTUH
2021-22 Std.Id:20011A0403

Experiment No:4 Date:

Name of the Experiment: Generation of various signals using


TIME BASIS Equations

Number of Programs:8

Aim:
To generate different types of signals by using Time Basis and to observe the output.

Software Required:
MATLAB.

Theory:
If the amplitude of the signal is defined at every instant of time then it is called
continuous time signal. If the amplitude of the signal is defined at only at some instants
of
time then it is called discrete time signal. If the signal repeats itself at regular intervals then it
is called periodic signal. Otherwise they are called aperiodic signals.
EX: ramp,Impulse,unit step, sinc- Aperiodic signals
square,sawtooth,triangular sinusoidal – periodic signals.
Ramp sinal: The ramp function is a unitary real function, easily computable as the mean of
the independent variable and its absolute value.This function is applied in engineering. The
name ramp function is derived from the appearance of its graph.
r(t)= t when t>=0
= 0 else

Unit impulse signal: One of the more useful functions in the study of linear systems is the
"unit impulse function."An ideal impulse function is a function that is zero everywhere but at
the origin, where it isinfinitely high. However, the area of the impulse is finite
Y(t)= 1 when t=0
= 0 other wise

Unit step signal: The unit step function and the impulse function are considered to be
fundamental functions in engineering, and it is strongly recommended that the reader
becomes very familiar with both of these functions.
u(t)= 0 if t < 0
= 1 if t > 0

Sinc signal: There is a particular form that appears so frequently in communications


engineering, that we give it its own name. This function is called the "Sinc function”.
The Sinc function is defined in the following manner:
sinc(x) =1 when x=0
= (sin(pi*x))/(pi*x) else

Procedure:
⮚ Switch on the system with MATLAB tool.
⮚ Launch MATLAB software by clicking on MATLAB icon on the desktop.
⮚ Create new program from NEW option in FILE menu.

BS LAB 24 ECE-CEH-JNTUH
2021-22 Std.Id:20011A0403

⮚ Write the program in TEXT EDITOR window.


⮚ Save the program with .m extension.
⮚ Run the program from the EDITOR menu or by pressing F5.
⮚ Check the COMMAND window for output values/errors.If any errors are there,debug the
errors,modify the program,and go to step 6.
⮚ Observe the text outputs in command window and graphical outputs in FIGURES.
⮚ Close the MATLAB tool properly.
⮚ Switch off the system.

Program-1:Generation of unit step using Time Basis:


clc;
close all;
clear all;
t=-10:0.01:10;
y=0*(t<0)+1*(t>0);
plot(t,y);
axis([-12,12,-1,2]);
title('Unit Step Signal using Time Basis');
xlabel('time');
ylabel('amplitude');
grid on;

Output-1:

Program-2:Generation of unit impulse signal using Time Basis:


clc;
close all;
clear all;
t=-10:0.01:10;
y=0*(t<0)+1*(t==0)+0*(t>0);
plot(t,y);
axis([-12,12,-1,2]);
title('Unit Impulse Signal using Time Basis');
xlabel('time');

BS LAB 25 ECE-CEH-JNTUH
2021-22 Std.Id:20011A0403

ylabel('amplitude');
grid on;
Output-2:

Program-3:Generation of square wave using Time Basis:


clc;
close all;
clear all;
t=2:0.01:10;
y=0*(t>2&t<4)+1*(t>4&t<6)+0*(t>6&t<8)+1*(t>8&t<10);
plot(t,y);
axis([0,12,-2,3]);
title('Square Wave using Time Basis');
xlabel('time');
ylabel('amplitude');
grid on;

Output-3:

Program-4:Generation of triangular wave using Time Basis:


clc;
close all;
clear all;
t=0:0.01:8;

BS LAB 26 ECE-CEH-JNTUH
2021-22 Std.Id:20011A0403

y=t.*(t>=0&t<2)+(-t+4).*(t>=2&t<6)+(t-8).*(t>=6&t<8);
plot(t,y);
axis([-2,10,-3,3]);
title('Triangular Wave using Time Basis');
xlabel('time');
ylabel('amplitude');
grid on;

Output-4:

Program-5:Generation of ramp signal using Time Basis:


clc;
close all;
clear all;
t=0:0.01:10;
y=t.*(t>=0&t<=10);
plot(t,y);
axis([0,12,0,12]);
title('Ramp Signal using Time Basis');
xlabel('time');
ylabel('amplitude');
grid on;

Output-5:

BS LAB 27 ECE-CEH-JNTUH
2021-22 Std.Id:20011A0403

Program-6:Generation of exponential signal using Time Basis:


clc
clear all
close all
t=-10:0.01:10;
y=exp(2*t).*(t>=-10&t<=10);
plot(t,y);
title('Exponential Signal using Time Basis');
xlabel('time');
ylabel('amplitude');
grid on;

Output-6:

Program-7:Generation of unit step signal using Time Basis:


clc
clear all
close all
f=0.01;
t=-10:0.001:10;
y=sin(pi*t)./(pi*t).*(-10<=t<=10);
plot(t,y);
title('Sinc Signal using Time Basis');
xlabel('time');
ylabel('amplitude');
grid on;
Output-7:

BS LAB 28 ECE-CEH-JNTUH
2021-22 Std.Id:20011A0403

Program-8:Generation of unit impulse signal using Time Basis:


clc;
close all;
clear all;
t=-10:0.01:10;
y=t.^2(-10<=t<=10);
plot(t,y);
axis([-12,12,0,100]);
title('Parabola using Time Basis');
xlabel('time');
ylabel('amplitude');
grid on;

Output-8:

Result:
Hence the different types of signals by using Loops and Conditional statements are generated
and output is observed.

BS LAB 29 ECE-CEH-JNTUH
2021-22 Std.Id:20011A0403

Experiment No:5 Date:

Name of the Experiment: Basic Arithmetic Operations on


Signals and Sequences

Number of Programs:2

Aim:
To perform the basic arithmetic operations like addition, subtraction,multiplication,division on
two signals and observe the obtained results.

Software Required:
MATLAB.

Theory:
A signal, comprises of a set of information expressed as a function of any number of independent variables,
that can be given as an input to a system, or derived as output from the system, to realize its true practical

∴ being well acquainted with some basic signal operations may come really handy to enhance the
utility. The signal we derive out of a complex system might not always be in the form we want,

understandability and applicability of signals.


Signal Operations

Addition

Subtraction

Multiplication

division

Addition:
Addition can be carried out using the ‘ + ‘ symbol and plotting will give you the result.

Subtraction:
With the same program code as of addition replacing arithmetic operator ‘ – ‘ we can perform
subtraction in signals.

Multiplication:
BS LAB 30 ECE-CEH-JNTUH
2021-22 Std.Id:20011A0403

By using ‘ * ‘ ( asterisk) operator we can perform multiplication of signals.

Division:
By using ' / ' operator we can perform division of signals.

Procedure:
⮚ Switch on the system with MATLAB tool.
⮚ Launch MATLAB software by clicking on MATLAB icon on the desktop.
⮚ Create new program from NEW option in FILE menu.
⮚ Write the program in TEXT EDITOR window.
⮚ Save the program with .m extension.
⮚ Run the program from the EDITOR menu or by pressing F5.
⮚ Check the COMMAND window for output values/errors.If any errors are there,debug the
errors,modify the program,and go to step 6.
⮚ Observe the text outputs in command window and graphical outputs in FIGURES.
⮚ Close the MATLAB tool properly.
⮚ Switch off the system.

Program-1:Basic Operations on Signal-1(i) and Signal-1(ii):


clc;
clear all;
close all;
t=0:0.01:8;
y1=(2.*t).*(t>=0 & t<2)+4.*(t>=2 & t<6)+(-2*t+16).*(t>=6 & t<=8);
subplot(2,3,1);
plot(t,y1);
title('y1');
xlabel('time');
ylabel('y1 values');
axis([-1,9,-2,6]);
grid on;
y2=2.*(t>0 & t<3)+1.*(t>=3 & t<5)+2*(t>=5 & t<8);
subplot(2,3,2);
plot(t,y2);
title('y2');
xlabel('time');
ylabel('y2 values');
axis([-1,9,-2,4]);
grid on;

BS LAB 31 ECE-CEH-JNTUH
2021-22 Std.Id:20011A0403

y3=y1+y2;
subplot(2,3,3);
plot(t,y3);
title('y3');
xlabel('time');
ylabel('(y1+y2) values');
axis([-1,9,-2,8]);
grid on;
y4=y1-y2;
subplot(2,3,4);
plot(t,y4);
title('y4');
xlabel('time');
ylabel('(y1-y2) values');
axis([-1,9,-4,6]);
grid on;
y5=y1.*y2;
subplot(2,3,5);
plot(t,y5);
title('y5');
xlabel('time');
ylabel('(y1.*y2) values');
axis([-1,9,-2,10]);
grid on;
y6=y1./y2;
subplot(2,3,6);
plot(t,y6);
xlabel('time');
ylabel('(y1./y2) values');
axis([-1,9,-2,6]);
grid on;

Output-1:

Program-2:Basic Operations on Signal-2(i) and Signal-2(ii):

BS LAB 32 ECE-CEH-JNTUH
2021-22 Std.Id:20011A0403

clc;
clear all;
close all;
t=0:0.01:6;
y1=(-2.*t+6).*(t>0 & t<1)+(2.*t+2).*(t>=1 & t<2)+2.*(t>=2 & t<4)+
(-2.*t+14).*(t>=4 & t<5)+(2*t-6).*(t>=5 & t<6);
subplot(2,3,1);
plot(t,y1);
title('y1');
xlabel('time');
ylabel('y1 values');
axis([-2,8,-2,8]);
grid on;
y2=2.*(t>0 & t<2)+1.*(t>=2 & t<4)+2*(t>=4 & t<6);
subplot(2,3,2);
plot(t,y2);
title('y2');
xlabel('time');
ylabel('y2 values');
axis([-2,8,-2,4]);
grid on;
y3=y1+y2;
subplot(2,3,3);
plot(t,y3);
title('y3');
xlabel('time');
ylabel('(y1+y2) values');
axis([-2,8,-2,10]);
grid on;
y4=y1-y2;
subplot(2,3,4);
plot(t,y4);
title('y4');
xlabel('time');
ylabel('(y1-y2) values');
axis([-2,8,-2,6]);
grid on;
y5=y1.*y2;
subplot(2,3,5);
plot(t,y5);
title('y5');
xlabel('time');
ylabel('(y1.*y2) values');
axis([-2,8,-2,14]);
grid on;
y6=y1./y2;
subplot(2,3,6);
plot(t,y6);
xlabel('time');
ylabel('(y1./y2) values');
axis([-2,8,0,6]);
grid on;

BS LAB 33 ECE-CEH-JNTUH
2021-22 Std.Id:20011A0403

Output-2:

Result:
Hence the basic arithmetic operations like addition, subtraction,multiplication,division are
performed on two signals and obtained results are observed

BS LAB 34 ECE-CEH-JNTUH
2021-22 Std.Id:20011A0403

Experiment No:6 Date:

Name of the Experiment: Scaling Operations on


Signals and Sequences

Number of Programs:2

Aim:
To perform the scaling operations like time scaling,amplitude scaling on signal and observe the
obtained results.

Software Required:
MATLAB.

Theory:

Time Scaling

If a constant is multiplied to the time axis then it is known as Time scaling.

So the y-axis being same, the x- axis magnitude decreases or increases according to the sign of the
constant (whether positive or negative). Therefore, scaling can also be divided into two categories
as discussed below.

Time Compression

Whenever alpha is greater than zero, the signal’s amplitude gets divided by alpha whereas the value
of the Y-axis remains the same. This is known as Time Compression.

Time Expansion
When the time is divided by the constant alpha, the Y-axis magnitude of the signal get multiplied
alpha times, keeping X-axis magnitude as it is. Therefore, this is called Time expansion type signal.
Amplitude Scaling
Multiplication of a constant with the amplitude of the signal causes amplitude scaling. Depending
upon the sign of the constant, it may be either amplitude scaling or attenuation

Amplitude Compression

If the multiplied constant is less then 1 then it results in amplitude compression

Amplitude Expansion

If the multiplied constant is greater then 1 then it results in amplitude expansion

Procedure:
⮚ Switch on the system with MATLAB tool.
⮚ Launch MATLAB software by clicking on MATLAB icon on the desktop.

BS LAB 35 ECE-CEH-JNTUH
2021-22 Std.Id:20011A0403

⮚ Create new program from NEW option in FILE menu.


⮚ Write the program in TEXT EDITOR window.
⮚ Save the program with .m extension.
⮚ Run the program from the EDITOR menu or by pressing F5.
⮚ Check the COMMAND window for output values/errors.If any errors are there,debug the
errors,modify the program,and go to step 6.
⮚ Observe the text outputs in command window and graphical outputs in FIGURES.
⮚ Close the MATLAB tool properly.
⮚ Switch off the system.

Program-1:Scaling Operations on Signal-1:


clc;
clear all;
close all;
t=0:0.01:24;
y1=2*(t>0 & t<2)+t.*(t>=2 & t<4)+2*(t>=4 & t<6);
subplot(3,3,1);
plot(t,y1);
title('y1');
xlabel('time');
ylabel('y1 values');
axis([-2,26,-2,18]);
grid on;
y2=y1.*2;
subplot(3,3,2);
plot(t,y2);
title('y2');
xlabel('time');
ylabel('(y1.*2) values');
axis([-2,26,-2,18]);
grid on;
y3=y1./2;
subplot(3,3,3);
plot(t,y3);
title('y3');
xlabel('time');
ylabel('(y1./2) values');
axis([-2,26,-2,18]);
grid on;
y4=y1.*4;
subplot(3,3,4);
plot(t,y4);
title('y4');
xlabel('time');
ylabel('(y1.*4) values');
axis([-2,26,-2,18]);
grid on;
y5=y1./4;
subplot(3,3,5);
plot(t,y5);
title('y5');
xlabel('time');
ylabel('(y1./4) values');

BS LAB 36 ECE-CEH-JNTUH
2021-22 Std.Id:20011A0403

axis([-2,26,-2,18]);
grid on;
y6=2*(t>0 & t<1)+(2*t).*(t>=1 & t<2)+2*(t>=2 & t<3);
subplot(3,3,6);
plot(t,y6);
title('y6');
xlabel('time');
ylabel('y6 values');
axis([-2,26,-2,18]);
grid on;
y7=2*(t>0 & t<4)+(t/2).*(t>=4 & t<8)+2*(t>=8 & t<12);
subplot(3,3,7);
plot(t,y7);
title('y7');
xlabel('time');
ylabel('y7 values');
axis([-2,26,-2,18]);
grid on;
y8=2*(t>0 & t<0.5)+(4*t).*(t>=0.5 & t<1)+2*(t>=1 & t<1.5);
subplot(3,3,8);
plot(t,y8);
title('y8');
xlabel('time');
ylabel('y8 values');
axis([-2,26,-2,18]);
grid on;
y9=2*(t>0 & t<8)+(t/4).*(t>=8 & t<16)+2*(t>=16 & t<24);
subplot(3,3,9);
plot(t,y9);
xlabel('time');
ylabel('y9 values');
title('y9');
axis([-2,26,-2,18]);
grid on;

Output-1:

BS LAB 37 ECE-CEH-JNTUH
2021-22 Std.Id:20011A0403

Program-2:Scaling Operations on Signal-2:


clc;
clear all;
close all;
t=-10:0.01:10;
y1=sin(pi*t)./(pi*t);
subplot(3,3,1);
plot(t,y1);
title('y1');
xlabel('time');
ylabel('y1 values');
axis([-10,10,-2,6]);
grid on;
y2=y1.*2;
subplot(3,3,2);
plot(t,y2);
title('y2');
xlabel('time');
ylabel('(y1.*2) values');
axis([-10,10,-2,6]);
grid on;
y3=y1./2;
subplot(3,3,3);
plot(t,y3);
title('y3');
xlabel('time');
ylabel('(y1./2) values');
axis([-10,10,-2,6]);
grid on;
y4=y1.*4;
subplot(3,3,4);
plot(t,y4);
title('y4');
xlabel('time');
ylabel('(y1.*4) values');
axis([-10,10,-2,6]);
grid on;
y5=y1./4;
subplot(3,3,5);
plot(t,y5);
xlabel('time');
ylabel('(y1./4) values');
title('y5');
axis([-10,10,-2,6]);
grid on;
y6=sin(pi*t*2)./(pi*t*2);
subplot(3,3,6);
plot(t,y6);
title('y6');
xlabel('time');
ylabel('y7 values');
axis([-10,10,-2,6]);
grid on;
y7=sin(pi*(t/2))./(pi*(t/2));
subplot(3,3,7);

BS LAB 38 ECE-CEH-JNTUH
2021-22 Std.Id:20011A0403

plot(t,y7);
title('y7');
xlabel('time');
ylabel('y7 values');
axis([-10,10,-2,6]);
grid on;
y8=sin(pi*t*4)./(pi*t*4);
subplot(3,3,8);
plot(t,y8);
title('y8');
xlabel('time');
ylabel('y8 values');
axis([-10,10,-2,6]);
grid on;
y9=sin(pi*(t/4))./(pi*(t/4));
subplot(3,3,9);
plot(t,y9);
xlabel('time');
ylabel('y9 values');
title('y9');
axis([-10,10,-2,6]);
grid on;

Output-2:

Result:
Hence the the scaling operations like time scaling,amplitude scaling are performed on signal
and obtained results are observed.

BS LAB 39 ECE-CEH-JNTUH
2021-22 Std.Id:20011A0403

Experiment No:7 Date:

Name of the Experiment: Shifting and Folding of


Signals and Sequences

Number of Programs:4

Aim:
To perform the shifting in x-axis,shifting in y-axis,folding of signals and observe the obtained
results.

Software Required:
MATLAB.

Theory:
1. Time Shifting
Suppose that we have a signal x(t) and we define a new signal by adding/subtracting a finite time
value to/from it. We now have a new signal, y(t). The mathematical expression for this would be x(t
+t0).
Graphically, this kind of signal operation results in a positive or negative “shift” of the signal along
its time axis. However, note that while doing so, none of its characteristics are altered. This means
that the time-shifting operation results in the change of just the positioning of the signal without
affecting its amplitude or span.
Case 1 (t0 > 0)
When K is greater than zero, the shifting of the signal takes place towards "left" in the time domain.
Therefore, this type of shifting is known as Left Shifting of the signal.
Case 2 (t0 < 0)
When K is less than zero the shifting of signal takes place towards right in the time domain.
Therefore, this type of shifting is known as Right shifting.
2. Amplitude Shifting
Suppose that we have a signal x(t) and we define a new signal by adding/subtracting a finite
time value to/from it. We now have a new signal, y(t). The mathematical expression for this
would be x(t)+K
Graphically, this kind of signal operation results in a positive or negative “shift” of the signal along
its amplitude axis. However, note that while doing so, none of its characteristics are altered. This
means that the amplitude-shifting operation results in the change of just the amplitude of the signal
without affecting its position.

Case 1 (K > 0)
When K is greater than zero, the shifting of signal takes place towards up in the x-axis. Therefore,
this type of shifting is known as upward shifting.
Case 2 (K < 0)
When K is less than zero shifting of signal takes place towards downward in the X- axis.
Therefore, it is called downward shifting of the signal.
3. Folding of Signals
Folding along y-axis

BS LAB 40 ECE-CEH-JNTUH
2021-22 Std.Id:20011A0403

Suppose that we have a signal x(t) and we define a new signal by adding/subtracting a finite
time value to/from it. We now have a new signal, y(t). The mathematical expression for this
would be k*x(t) (k=-1)
Folding along x-axis
Suppose that we have a signal x(t) and we define a new signal by adding/subtracting a finite
time value to/from it. We now have a new signal, y(t). The mathematical expression for this
would be x(k*t) (k=-1)
Procedure:
⮚ Switch on the system with MATLAB tool.
⮚ Launch MATLAB software by clicking on MATLAB icon on the desktop.
⮚ Create new program from NEW option in FILE menu.
⮚ Write the program in TEXT EDITOR window.
⮚ Save the program with .m extension.
⮚ Run the program from the EDITOR menu or by pressing F5.
⮚ Check the COMMAND window for output values/errors.If any errors are there,debug the
errors,modify the program,and go to step 6.
⮚ Observe the text outputs in command window and graphical outputs in FIGURES.
⮚ Close the MATLAB tool properly.
⮚ Switch off the system.

Program-1:Shifting of Signal-1:
clc;
clear all;
close all;
t=0:0.01:4;
y1=((0.5).*t).*(t>0 & t<=2)+((-0.5).*(t-4)).*(t>2 & t<=4);
subplot(2,3,1);
plot(t,y1);
title('y1');
xlabel('time');
ylabel('y1 values');
axis([-3,6,-2,4]);
grid on;
y2=y1+2;
subplot(2,3,2);
plot(t,y2);
title('y2');
xlabel('time');
ylabel('y2 values');
axis([-3,6,-2,4]);
grid on;
y3=y1-2;
subplot(2,3,3);
plot(t,y3);
title('y3');
xlabel('time');
ylabel('y3 values');
axis([-3,6,-2,4]);
grid on;

BS LAB 41 ECE-CEH-JNTUH
2021-22 Std.Id:20011A0403

subplot(2,3,5);
plot(t-2,y1);
title('y4');
xlabel('time');
ylabel('y4 values');
axis([-3,6,-2,4]);
grid on;
subplot(2,3,6);
plot(t+2,y1);
xlabel('time');
ylabel('y5 values');
title('y5');
axis([-3,6,-2,4]);
grid on;

Output-1:

Program-2:Shifting of Signal-2:
clc;
clear all;
close all;
t=-1:0.01:1;
y1=1.*(t>-1 & t<1);
subplot(2,3,1);
plot(t,y1);
title('y1');
xlabel('time');
ylabel('y1 values');
axis([-4,4,-2,4]);
grid on;
y2=y1+2;
subplot(2,3,2);
plot(t,y2);
title('y2');
xlabel('time');
ylabel('y2 values');
axis([-4,4,-2,4]);
grid on;
y3=y2-2;

BS LAB 42 ECE-CEH-JNTUH
2021-22 Std.Id:20011A0403

subplot(2,3,3);
plot(t,y3);
title('y3');
xlabel('time');
ylabel('y3 values');
axis([-4,4,-2,4]);
grid on;
subplot(2,3,5);
plot(t-2,y1);
title('y4');
xlabel('time');
ylabel('y4 values');
axis([-4,4,-2,4]);
grid on;
subplot(2,3,6);
plot(t+2,y1);
xlabel('time');
ylabel('y5 values');
title('y5');
axis([-4,4,-2,4]);
grid on;

Output-2:

Program-3:Folding of Signal-3:
clc;
clear all;
close all;
t=0:0.01:(2*pi);
y1=sin(t);
subplot(2,2,1);
plot(t,y1);
title('y1');
xlabel('time');
ylabel('y1 values');
axis([-2,9,-2,2]);
grid on;
y2=fliplr(y1);
subplot(2,2,2);

BS LAB 43 ECE-CEH-JNTUH
2021-22 Std.Id:20011A0403

plot(t,y2);
title('y2');
xlabel('time');
ylabel('y2 values');
axis([-2,9,-2,2]);
grid on;

Output-3:

Program-4:Folding of Signal-4:
clc;
clear all;
close all;
t=-2:0.001:2;
y1=1.*(t>-2 & t<=-1)+2.*(t>-1 & t<=0)+(-2).*(t>0 & t<=1)+(-1).*(t>1 & t<2);
subplot(2,1,1);
plot(t,y1);
title('y1');
xlabel('time');
ylabel('y1 values');
axis([-3,3,-3,3]);
grid on;
y2=fliplr(y1);
subplot(2,1,2);
plot(t,y2);
title('y2');
xlabel('time');
ylabel('y2 values');
axis([-3,3,-3,3]);
grid on;

Output-4:

BS LAB 44 ECE-CEH-JNTUH
2021-22 Std.Id:20011A0403

Result:
Hence the shifting in x-axis,shifting in y-axis,folding of signals is done and obtained results
are observed.

BS LAB 45 ECE-CEH-JNTUH
2021-22 Std.Id:20011A0403

Experiment No:8 Date:

Name of the Experiment: Finding Real and Imaginary


Parts of a Signal

Number of Programs:1

Aim:
To find the real and imaginary parts of a complex signal.

Software Required:
MATLAB.

Theory:
A complex analog signalx(t) is formed by the signal pair{xR(t),xI(t)}, where
both xR(t) and xI(t) are the ordinary real signals. The relationship between these
signals is given by:
x(t) =xR(t) +jxI(t) wherej=√−1.
A complex discrete (or digital) signal x(n) is defined in a similar manner:
x(n) =xR(n) +jxI(n)
A complex number x can be represented by its real and imaginary parts xR and xI, or
by its magnitude and phase a and θ, respectively.
The relationshipbetween these values is given below:
Complex signals are defined both in continuous time and discrete time:
x(t) =a(t) exp(jθa(t)) and
x(n) =a(n) exp(jθ(n))
where
a(t) =(x2R(t) +x2I(t)).^(0.5) and
a(n) =(x2R(n) +x2I(n)).^(0.5)
θ(t) = arctan(xI(t)/xR(t)) and
θ(n) = arctan(xI(n)/xR(n))
xR(t) =a(t) cos(θ(t)) and
xR(n) =a(n) cos(θ(n))
xI(t) =a(t) sin(θ(t)) and
xI(n) =a(n) sin(θ(n))
The magnitudes a(t) and a(n) are also known as envelopes of x(t) and x(n)

Procedure:
⮚ Switch on the system with MATLAB tool.
⮚ Launch MATLAB software by clicking on MATLAB icon on the desktop.
⮚ Create new program from NEW option in FILE menu.
⮚ Write the program in TEXT EDITOR window.

BS LAB 46 ECE-CEH-JNTUH
2021-22 Std.Id:20011A0403

⮚ Save the program with .m extension.


⮚ Run the program from the EDITOR menu or by pressing F5.
⮚ Check the COMMAND window for output values/errors.If any errors are
there,debug the errors,modify the program,and go to step 6.
⮚ Observe the text outputs in command window and graphical outputs in FIGURES.
⮚ Close the MATLAB tool properly.
⮚ Switch off the system.
Program:Finding Real and Imaginary Parts of a Complex Signal:
clc;
clear all;
close all;
t=0:0.001:4*pi;
x=cos(t)+j.*sin(t);
subplot(3,1,1);
plot(t,x);
title(‘complex signal’);
xlabel(‘time’);
ylabel(‘amplitude’);
grid on;
subplot(3,1,2);
plot(t,real(x));
title(‘real part of signal’);
xlabel(‘time’);
ylabel(‘amplitude’);
grid on;
subplot(3,1,3);
plot(x,imag(x));
title(‘imaginary part of signal’);
xlabel(‘time’);
ylabel(‘amplitude’);
grid on;

Output:

BS LAB 47 ECE-CEH-JNTUH
2021-22 Std.Id:20011A0403

Result:
Hence the real and imaginary parts of a complex signal are found.

BS LAB 48 ECE-CEH-JNTUH
2021-22 Std.Id:20011A0403

Experiment No:9 Date:

Name of the Experiment: Finding Even and Odd


Components of a Signal

Number of Programs:2

Aim:
To find the Even and Odd Components of signal.

Software Required:
MATLAB.

Theory:
One of characteristics of signal is symmetry that may be useful for signal analysis. Even signals are
symmetric around vertical axis, and Odd signals are symmetric about origin.

Even Signal:

A signal is referred to as an even if it is identical to its time-reversed counterparts; x(t) = x(-t).

Odd Signal:

A signal is odd if x(t) = -x(-t).

An odd signal must be 0 at t=0, in other words, odd signal passes the origin.

Using the definition of even and odd signal, any signal may be decomposed into a sum of its even
part, xe(t), and its odd part, xo(t), as follows:

xe(t)=1/2{x(t)+x(-t)}

xo(t)=1/2{x(t)-x(-t)}

x(t)=xe(t)+xo(t)

Procedure:
⮚ Switch on the system with MATLAB tool.
⮚ Launch MATLAB software by clicking on MATLAB icon on the desktop.
⮚ Create new program from NEW option in FILE menu.
⮚ Write the program in TEXT EDITOR window.
⮚ Save the program with .m extension.
⮚ Run the program from the EDITOR menu or by pressing F5.
⮚ Check the COMMAND window for output values/errors.If any errors are there,debug the
errors,modify the program,and go to step 6.
⮚ Observe the text outputs in command window and graphical outputs in FIGURES.
⮚ Close the MATLAB tool properly.
⮚ Switch off the system.

BS LAB 49 ECE-CEH-JNTUH
2021-22 Std.Id:20011A0403

Program-1:Finding Even and Odd Components of Signal-1:


clc;
clear all;
close all;
t=-2:0.0001:2;
y1=2.*(t>0 & t<2);
subplot(2,2,1);
plot(t,y1);
title('y1');
xlabel('time');
ylabel('y1 values');
axis([-4,4,-2,4]);
grid on;
y2=fliplr(y1);
subplot(2,2,2);
plot(t,y2);
title('y2');
xlabel('time');
ylabel('y2 values');
axis([-4,4,-2,4]);
grid on;
y3=(0.5).*(y1+y2);
subplot(2,2,3);
plot(t,y3);
title('y3');
xlabel('time');
ylabel('y3 values');
axis([-4,4,-2,4]);
grid on;
y4=(0.5).*(y1-y2);
subplot(2,2,4);
plot(t,y4);
title('y4');
xlabel('time');
ylabel('y4 values');
axis([-4,4,-2,4]);
grid on;

Output-1:

BS LAB 50 ECE-CEH-JNTUH
2021-22 Std.Id:20011A0403

Program-2:Finding Even and Odd Components of Signal-2:


clc;
clear all;
close all;
t=-2:0.0001:2;
y1=t.*(t>0 & t<1)+(-t+2).*(t>=1 & t<2);
subplot(2,2,1);
plot(t,y1);
title('y1');
xlabel('time');
ylabel('y1 values');
axis([-3,3,-2,2]);
grid on;
y2=flip(y1);
subplot(2,2,2);
plot(t,y2);
title('y2');
xlabel('time');
ylabel('y2 values');
axis([-3,3,-2,2]);
grid on;
y3=(0.5).*(y1+y2);
subplot(2,2,3);
plot(t,y3);
title('y3');
xlabel('time');
ylabel('y3 values');
axis([-3,3,-2,2]);
grid on;
y4=(0.5).*(y1-y2);
subplot(2,2,4);
plot(t,y4);
title('y4');
xlabel('time');
ylabel('y4 values');
axis([-3,3,-2,2]);
grid on;

BS LAB 51 ECE-CEH-JNTUH
2021-22 Std.Id:20011A0403

Output-2:

Result:
Hence the Even and Odd Components of signal are found.

BS LAB 52 ECE-CEH-JNTUH
2021-22 Std.Id:20011A0403

Experiment No:10 Date:

Name of the Experiment: Verification of samling Theorem

Number of Programs:1

Aim:
To verify the sampling theorm for over sampling,critical sampling,under sampling cases and to
observe the output waveforms.

Software Required:
MATLAB.

Theory:
The Sampling Theorem

The sampling theorem is an important aid in the design and analysis


of communication systems involving the use of continuous time
functions of finite bandwidth. The theorem states that, if a function
of time, f(t), contains no frequencies of W hertz or higher, then it
is completely determined by giving the value of the function at a
series of points spaced (2W)−1 seconds apart. The sampling rate of
2W samples per second is called the Nyquist rate.

The sampling theorem specifies the minimum-sampling rate at which a continuous-time signal
needs to be uniformly sampled so that the original signal can be completely recovered or
reconstructed by these samples alone. This is usually referred to as Shannon's sampling theorem in
the literature.

If a continuous time signal contains no frequency components higher than W hz, then it can be
completely determined by uniform samples taken at a rate fs samples per second where

fs>=2W

or, in term of the sampling period

Undersampling

When a bandpass signal is sampled slower than its Nyquist rate, the samples are indistinguishable
from samples of a low-frequency alias of the high-frequency signal. That is often done purposefully
in such a way that the lowest-frequency alias satisfies the Nyquist criterion, because the bandpass
signal is still uniquely represented and recoverable. Such undersampling is also known as bandpass
sampling, harmonic sampling, IF sampling, and direct IF to digital conversion.[22]

Oversampling

Oversampling is used in most modern analog-to-digital converters to reduce the distortion

BS LAB 53 ECE-CEH-JNTUH
2021-22 Std.Id:20011A0403

introduced by practical digital-to-analog converters, such as a zero-order hold instead of


idealizations like the Whittaker–Shannon interpolation formula.[23]

Critical Sampling

fs=2W

A bandlimited signal can be reconstructed exactly if it is sampled at a rate atleast twice the
maximum frequency component in it." Figure 1 shows a signal g(t) that is bandlimited.

Figure 1: Spectrum of band limited signal g(t)


The maximum frequency component of g(t) is fm. To recover the signal g(t) exactly from its
samples it has to be sampled at a rate fs ≥ 2fm.
The minimum required sampling rate fs = 2fm is called ' Nyquist rate
Proof: Let g(t) be a bandlimited signal whose bandwidth is fm (wm = 2πfm).

Figure 2: (a) Original signal g(t) (b) Spectrum G(w)


δ (t) is the sampling signal with fs = 1/T > 2fm.

Figure 3: (a) sampling signal δ (t) ) (b) Spectrum δ (w)

Figure 4: (a) sampled signal gs(t) (b) Spectrum Gs(w)


To recover the original signal G(w):
1. Filter with a Gate function, H2wm(w) of width 2wm
Scale it by T.

BS LAB 54 ECE-CEH-JNTUH
2021-22 Std.Id:20011A0403

Figure 5: Recovery of signal by filtering with a fiter of width 2wm Aliasing ws < 2wm.

Figure 6: Aliasing due to inadequate sampling


Aliasing leads to distortion in recovered signal. This is the reason why sampling frequency
should be atleast twice thebandwidth of the signal. Oversampling ws >2wm. This condition
avoid aliasing.

Figure 7: Oversampled signal-avoids aliasing

Procedure:
⮚ Switch on the system with MATLAB tool.
⮚ Launch MATLAB software by clicking on MATLAB icon on the desktop.
⮚ Create new program from NEW option in FILE menu.
⮚ Write the program in TEXT EDITOR window.
⮚ Save the program with .m extension.
⮚ Run the program from the EDITOR menu or by pressing F5.
⮚ Check the COMMAND window for output values/errors.If any errors are there,debug the
errors,modify the program,and go to step 6.
⮚ Observe the text outputs in command window and graphical outputs in FIGURES.
⮚ Close the MATLAB tool properly.
⮚ Switch off the system.

Program:Verification of Sampling theorem:


clc;
clear all;
close all;
tp=0.05;
t=0:0.0005:tp;
fm=input('enter the analog signal freq:');
xa=cos(2*pi*fm*t);
fsu=1.3*fm;
fsc=2*fm;

BS LAB 55 ECE-CEH-JNTUH
2021-22 Std.Id:20011A0403

fso=10*fm;
nu=0:1/fsu:tp;
nc=0:1/fsc:tp;
no=0:1/fso:tp;
xu=cos(2*pi*fm*nu);
xc=cos(2*pi*fm*nc);
xo=cos(2*pi*fm*no);
subplot(3,1,1);plot(t,xa,'b',nu,xu,'r*-');title('under sampling');
subplot(3,1,2);plot(t,xa,'b',nc,xc,'r*-');title('critical sampling');
subplot(3,1,3);plot(t,xa,'b',no,xo,'r*-');title('over sampling');

Input:
enter the analog signal freq:50;

Output:

Result:
Hence the sampling theorm is verified for over sampling,critical sampling,under sampling
cases and output waveforms are observed.

BS LAB 56 ECE-CEH-JNTUH
2021-22 Std.Id:20011A0403

Experiment No:11 Date:

Name of the Experiment: Verification of Gibbs Phenomenon

Number of Programs:1

Aim:
To verify the Gibbs Phenomenon at 4 different number of Harmonics of a signal and to observe
the output waveforms.

Software Required:
MATLAB.

Theory:
Gibbs Phenomenon:
The Gibbs phenomenon, the Fourier series of a piecewise continuously differentiable
periodic function behaves at a jump discontinuity.The n the approximated function shows
amounts of ripples at the points of discontinuity. This is known as the Gibbs Phenomina .
partial sum of the Fourier series has large oscillations near the jump, which might increase
the maximum of the partial sum above that of the function itself. The overshoot does not die
out as the frequency increases, but approaches a finite limit
The Gibbs phenomenon involves both the fact that Fourier sums overshoot at a jump
discontinuity, and that this overshoot does not die out as the frequency increases.
Gibbs Phenomenon is used to convert the sine wave in to square wave by adding the
number of harmonics to the sine wave using fourier series. if you give the highest number of
harmonics (32 or 64) the output graphs show how gradually the sine converts in to square wave.
From a signal processing point of view, the Gibbs phenomenon is the step response of a low-pass
filter, and the oscillations are called ringing or ringing artifacts. Truncating the Fourier transform of
a signal on the real line, or the Fourier series of a periodic signal (equivalently, a signal on the
circle) corresponds to filtering out the higher frequencies by an ideal (brick-wall) low-pass/high-cut
filter. This can be represented as convolution of the original signal with the impulse response of the
filter (also known as the kernel), which is the sinc function. Thus the Gibbs phenomenon can be
seen as the result of convolving a Heaviside step function (if periodicity is not required) or a square
wave (if periodic) with a sinc function: the oscillations in the sinc function cause the ripples in the
output.

Formula:

Gibbs phenomenon:

𝑓(𝑡) = 𝑎0 + Σ (𝑎n 𝑐𝑜𝑠 𝑐𝑜𝑠 𝑛𝑤𝑡 + 𝑏n 𝑠𝑖𝑛 𝑠𝑖𝑛 𝑛𝑤𝑡 )


n=1
Where1
𝑎T = 𝑓(𝑡)𝑑𝑡
ƒ 2 T
0 T 0 𝑏 = ƒ
2
T
𝑎n =
ƒ0 T
BS LAB 57 ECE-CEH-JNTUH
2021-22 Std.Id:20011A0403
𝑓(𝑡) 𝑐𝑜𝑠 𝑐𝑜𝑠 𝑛𝑤𝑡 𝑑𝑡
𝑓(𝑡) 𝑠𝑖𝑛 𝑠𝑖𝑛 𝑛𝑤𝑡 𝑑𝑡
n T 0

BS LAB 58 ECE-CEH-JNTUH
2021-22 Std.Id:20011A0403

Procedure:
⮚ Switch on the system with MATLAB tool.
⮚ Launch MATLAB software by clicking on MATLAB icon on the desktop.
⮚ Create new program from NEW option in FILE menu.
⮚ Write the program in TEXT EDITOR window.
⮚ Save the program with .m extension.
⮚ Run the program from the EDITOR menu or by pressing F5.
⮚ Check the COMMAND window for output values/errors.If any errors are there,debug the
errors,modify the program,and go to step 6.
⮚ Observe the text outputs in command window and graphical outputs in FIGURES.
⮚ Close the MATLAB tool properly.
⮚ Switch off the system.

Program:Verification of Gibbs Phenomenon:


clc;
clear all;
close all;
t=0:0.01:2*pi;
y1=sin(t);
y2=sin(3*t)/3;
y3=sin(5*t)/5;
y4=sin(7*t)/7;
y5=sin(9*t)/9;
y6=sin(11*t)/11;
subplot(2,2,1);plot(t,y1,t,y2,t,y3,t,y1+y2+y3);
title('with 3 freqs');grid on;legend('y1','y2','y3','y');
subplot(2,2,2);plot(t,y1,t,y2,t,y3,t,y4,t,y1+y2+y3+y4);
title('with 4 freqs');grid on;legend('y1','y2','y3','y4','y');
subplot(2,2,3);plot(t,y1,t,y2,t,y3,t,y4,t,y5,t,y1+y2+y3+y4+y5);
title('with 5 freqs');grid on;legend('y1','y2','y3','y4','y5','y');
subplot(2,2,4);plot(t,y1,t,y2,t,y3,t,y4,t,y5,t,y6,t,y1+y2+y3+y4+y5+y6);
title('with 6 freqs');grid on;legend('y1','y2','y3','y4','y5','y6','y');

Output :

BS LAB 59 ECE-CEH-JNTUH
2021-22 Std.Id:20011A0403

Result:
Hence the Gibbs Phenomenon is verified at 4 different number of Harmonics of a signal and
the output waveforms are observed.

BS LAB 51 ECE-CEH-JNTUH
0
2021-22 Std.Id:20011A0403

Experiment No:12 Date:

Name of the Experiment: Convolution of Signals

Number of Programs:3

Aim:
To perform the convolution of two signals and to observe the obtained output waveforms.

Software Required:
MATLAB.

Theory:
Convolution
Convolution is the basic concept in signal processing that states an input signal can be combined
with the system's function to find the output signal. It is the integral of the product of two
waveforms after one has reversed and shifted; the symbol for convolution is

That is the convolution integral and is used to find the convolution


of a signal and a system; typically a = -∞ and b = +∞.

Consider two waveforms f and g. By calculating the convolution, we determine how much a
reversed function g must be shifted along the x-axis to become identical to function f. The
convolution function essentially reverses and slides function g along the axis, and calculates the
integral of their (f and the reversed and shifted g) product for each possible amount of sliding.
When the functions match, the value of (f*g) is maximized. This occurs because when positive
areas (peaks) or negative areas (troughs) are multiplied, they contribute to the integral.

Convolution involves the following operations.


1. Folding
2. Multiplication
3. Addition
4. Shifting
Y[n]=T∑k=–∞ 𝑥[𝑘]𝛿(𝑛 − 𝑘)

These operations can be represented by a Mathematical Expression as follows:


x[n]= Input signal Samples
h[ n-k]= Impulse response co-efficient.
y[ n]= Convolution output.
n = No. of Input samples
h = No. of Impulse response co-efficient.
Example : X(n)={1 2 -1 0 1}, h(n)={ 1,2,3,-1}

BS LAB 60 ECE-CEH-JNTUH
2021-22 Std.Id:20011A0403

Calculations:
Convolution of Square and a Triangular Signal:
The given signals x(t) and h(t) can be mathematically expressed as :
X(t)={𝑡 𝑓𝑜𝑟 0 ≤ 𝑡 ≤ 2 4 − 𝑡 𝑓𝑜𝑟 2 ≤ 𝑡 ≤ 4

h(t)=2 for 0≤ 𝑡 ≤ 2

for t<0
x(𝜏)ℎ(𝑡 − 𝜏) = 0

y(t) =ƒ 𝑥(𝜏)ℎ(𝑡 − 𝜏)𝑑=0

for 0<t<2
now, x(𝜏) = 𝜏
and h(t- 𝜏)=2 (for 0<t<2)

t
y(t) ℎ (𝑡 − 𝜏)𝑑
𝑥()ℎ
= ƒ0
t
=ƒ0 (𝜏)(2) 𝑑
𝜏2
=2[t ]0
2

For 2≤ 𝑡 ≤
4 t
2 𝑥(𝜏)ℎ(𝑡 − 𝜏)𝑑𝜏+ ƒ 𝑥(𝜏)ℎ(𝑡 − 𝜏)𝑑
2
Y(t) = ƒt–2 t
2
=ƒt–2
2
𝜏(2) 𝑑 + ƒ2 (4 − 𝜏)(2) 𝑑
𝜏 2 t
=2[ ]t–2+ƒ2 (8 − 2𝜏) 𝑑
2
=-2𝑡2 + 12𝑡 + 12

For 4≤ 𝑡 ≤
6
4 ℎ (𝑡 − 𝜏)𝑑
𝑥()ℎ
Y(t) =ƒt–2
4
=ƒ 2(4 − 𝜏)𝑑
t–
2 (8𝑑𝑡 − 2𝑑)
4

t–
2

=𝑡2 − 12𝑡 + 36

For𝑡 ≥6
Y(t) =0

Combining all we have,

BS LAB 61 ECE-CEH-JNTUH
2021-22 Std.Id:20011A0403
Y(t)={0 𝑓𝑜𝑟 𝑡 < 0 𝑡2 𝑓𝑜𝑟 0 ≤ 𝑡 ≤ 2 − 2𝑡2 + 12𝑡 − 12 𝑓𝑜𝑟 2 ≤
𝑡 ≤ 4 𝑡2 + 12𝑡 − 36 𝑓𝑜𝑟 4 ≤ 𝑡 ≤ 6 0 𝑓𝑜𝑟 𝑡 > 6
Procedure:
⮚ Switch on the system with MATLAB tool.
⮚ Launch MATLAB software by clicking on MATLAB icon on the desktop.

BS LAB 62 ECE-CEH-JNTUH
2021-22 Std.Id:20011A0403

⮚ Create new program from NEW option in FILE menu.


⮚ Write the program in TEXT EDITOR window.
⮚ Save the program with .m extension.
⮚ Run the program from the EDITOR menu or by pressing F5.
⮚ Check the COMMAND window for output values/errors.If any errors are there,debug the
errors,modify the program,and go to step 6.
⮚ Observe the text outputs in command window and graphical outputs in FIGURES.
⮚ Close the MATLAB tool properly.
⮚ Switch off the system.

Program-1:Convolution of Square signal and a Square signal:


clc;
clear all;
close all;
t1s=0; t1e=4;
t2s=0; t2e=5;
step_val=0.1;
t1=t1s:step_val:t1e;
x1=double((t1>=0)&(t1<4));
t2=t2s:step_val:t2e;
x2=double((t2>=0)&(t2<4));
t3=t1s+t2s:step_val:t2e+t1e;
x=conv(x1,x2);
subplot(3,1,1);plot(t1,x1);title('first signal');grid on;axis([t1s+t2s-1,t1e+t2e+1,min(x1)-
1,max(x1)+1]);
subplot(3,1,2);plot(t2,x2);title('second signal');grid on;axis([t1s+t2s-1,t1e+t2e+1,min(x2)-
1,max(x2)+1]);
subplot(3,1,3);plot(t3,x);title('conv signal');grid on;axis([t1s+t2s-1,t1e+t2e+1,min(x)-1,max(x)+1]);

Output-1:

Program-2:Convolution of Square signal and a Triangular signal:

BS LAB 63 ECE-CEH-JNTUH
2021-22 Std.Id:20011A0403

clc;
clear all;
close all;
t1s=0; t1e=4;
t2s=0; t2e=5;
step_val=0.1;
t1=t1s:step_val:t1e;
x1=double((t1>=0)&(t1<4));
t2=t2s:step_val:t2e;
x2=double((t2/2).*(t2>=0&t2<2)+((-t2/2)+2).*(t2>=2&t2<4));
t3=t1s+t2s:step_val:t2e+t1e;
x=conv(x1,x2);
subplot(3,1,1);plot(t1,x1);title('first signal');grid on;axis([t1s+t2s-1,t1e+t2e+1,min(x1)-
1,max(x1)+1]);
subplot(3,1,2);plot(t2,x2);title('second signal');grid on;axis([t1s+t2s-1,t1e+t2e+1,min(x2)-
1,max(x2)+1]);
subplot(3,1,3);plot(t3,x);title('conv signal');grid on;axis([t1s+t2s-1,t1e+t2e+1,min(x)-1,max(x)+1]);

Output-2:

Program-3:Convolution of Cos signal and Sine signal:


clc;
clear all;
close all;
t1s=0; t1e=2*pi;
t2s=0; t2e=2*pi;
step_val=0.01;
t1=t1s:step_val:t1e;
x1=double(sin(t1).*(t1>=0&t1<2*pi));
t2=t2s:step_val:t2e;
x2=double(cos(t2).*(t2>=0&t2<2*pi));
t3=t1s+t2s:step_val:t2e+t1e;

BS LAB 64 ECE-CEH-JNTUH
2021-22 Std.Id:20011A0403

x=conv(x1,x2);
subplot(3,1,1);plot(t1,x1);title('first signal');grid on;axis([t1s+t2s-1,t1e+t2e+1,min(x1)-
1,max(x1)+1]);
subplot(3,1,2);plot(t2,x2);title('second signal');grid on;axis([t1s+t2s-1,t1e+t2e+1,min(x2)-
1,max(x2)+1]);
subplot(3,1,3);plot(t3,x);title('conv signal');grid on;axis([t1s+t2s-1,t1e+t2e+1,min(x)-1,max(x)+1]);

Output-3:

Result:
Hence the convolution of two signals is performed and the obtained output waveforms are
observed.

Experiment No:13 Date:

BS LAB 65 ECE-CEH-JNTUH
2021-22 Std.Id:20011A0403

Name of the Experiment: Verification of Linearity of a System

Number of Programs:3

Aim:
To verify whether the given system is a Linear or a Non-Linear System.

Software Required:
MATLAB.

Theory:
Linear or Non-linear Systems (Linearity Property):
A linear system is a system which follows the superposition principle. Let us consider a system
having its response as ‘T’, input as x(n) and it produces output y(n). This is shown in figure below:
Let us consider two inputs. Input x1(n) produces output y1(n) and input x2(n) produces output
y2(n). Now consider two arbitrary constants a1 and a2. Then simply multiply these constants with
input x1(n) and x2(n) respectively. Thus a1x1(n) produces output a1y1(n) and a2x2(n) produces
output a2y2(n).
Theorem for linearity of the system:
A system is said to be linear if the combined response of a1x1(n) and a2x2(n) is equal to the
addition of the individual responses.
That means,
T[a1 x1(n) + a2 x2(n)] = a1 T[x1(n)] + a2 T[x2(n)].....................1)
The above theorem is also known as superposition theorem.
Important Characteristic:
Linear system has one important characteristic: If the input to the system is zero then it produces
zero output. If the given system produces some output (non-zero) at zero input then the system is
said to be Non-linear system. If this condition is satisfied then apply the superposition theorem to
determine whether the given system is linear or not?
For continuous time system:
Similar to the discrete time system a continuous time system is said to be linear if it follows the
superposition theorem.
Let us consider two systems as follows:
y1(t) = f[x1(t)]
And y2(t) = f[x2(t)]
Here y1(t) and y2(t) are the responses of the system and x1(t) and x2(t) are the excitations. Then the
system is said to be linear if it satisfies the following expression:
f[a1 x1(t) + a2 x2(t)] = a1 y1(t) + a2 y2(t).....................1)
Where a1 and a2 are constants.
A system is said to be non-linear system if does not satisfies the above expression. Communication
channels and filters are examples of linear systems.
How to determine whether the given system is Linear or not?
To determine whether the given system is Linear or not, we have to follow the following steps:
Step 1: Apply zero input and check the output. If the output is zero then the system is linear. If this
step is satisfied then follow the remaining steps.
Step 2: Apply individual inputs to the system and determine corresponding outputs. Then add all
outputs. Denote this addition by y’(n). This is the R.H.S. of the 1st equation.
Step 3: Combine all inputs. Apply it to the system and find out y”(n). This is L.H.S. of equation (1).
Step 4: if y’(n) = y”(n) then the system is linear otherwise it is non-linear system.

BS LAB 66 ECE-CEH-JNTUH
2021-22 Std.Id:20011A0403

Procedure:
⮚ Switch on the system with MATLAB tool.
⮚ Launch MATLAB software by clicking on MATLAB icon on the desktop.
⮚ Create new program from NEW option in FILE menu.
⮚ Write the program in TEXT EDITOR window.
⮚ Save the program with .m extension.
⮚ Run the program from the EDITOR menu or by pressing F5.
⮚ Check the COMMAND window for output values/errors.If any errors are there,debug the
errors,modify the program,and go to step 6.
⮚ Observe the text outputs in command window and graphical outputs in FIGURES.
⮚ Close the MATLAB tool properly.
⮚ Switch off the system.

Program: Verification of Linearity of a System:


clc;
clear all;
close all;
x1=input('enter samples of sequence x1');
x2=input('enter samples of sequence x2');
h=input('enter the sample of system TF:h');
a1=input('enter scaling constant a1 value');
a2=input('enter scaling constant a2 value');
m=length(x1);
n=length(x2);
p=length(h);
if m>n
x2=[x2,zeros(1,m-n)];
n=m;
else
x1=[x1,zeros(1,n-m)];
m=n;
end
N=m+p-1;
disp('length of output is ');
disp(N);
x=a1*x1+a2*x2;
z1=conv(x,h);
y1=conv(x1,h);
y2=conv(x2,h);
z2=a1*y1+a2*y2;
disp('input sequence x1 is:');
disp(x1);
disp('input sequence x2 is:');
disp(x2);
disp('system sequence h is:');
disp(h);
disp('output sequence z1 is:');
disp(z1);

BS LAB 67 ECE-CEH-JNTUH
2021-22 Std.Id:20011A0403

disp('output sequence z2 is:');


disp(z2);
if(z1==z2)
disp('system is linear');
else
disp('system is non linear');
end
x3=a1*x1+a2*x2;
y11=x1.^2;
y22=x2.^2;
y33=x3.^2;
yt=a1*y11+a2*y22;
disp('input sequence x1 is:');
disp(x1);
disp('input sequence x2 is:');
disp(x2);
disp('system sequence h is:');
disp(h);
disp('output sequence x3 is:');
disp(x3);
disp('output sequence yt is:');
disp(yt);
if(yt==x3)
disp('system is linear');
else
disp('system is non linear');
end

Output:
enter samples of sequence x1[2 2 2]

enter samples of sequence x2[5 5 5]

enter the sample of system TF:h[1 2 3]

enter scaling constant a1 value2

enter scaling constant a2 value1

length of output is

input sequence x1 is:

2 2 2

input sequence x2 is:

5 5 5

system sequence h is:

BS LAB 68 ECE-CEH-JNTUH
2021-22 Std.Id:20011A0403

1 2 3

output sequence z1 is:

9 27 54 45 27

output sequence z2 is:

9 27 54 45 27

system is linear

input sequence x1 is:

2 2 2

input sequence x2 is:

5 5 5

system sequence h is:

1 2 3

output sequence x3 is:

9 9 9

output sequence yt is:

33 33 33

system is non linear

Result:
Hence the Linearity of System is verified.

BS LAB 69 ECE-CEH-JNTUH
2021-22 Std.Id:20011A0403

Experiment No:15 Date:

Name of the Experiment: Finding AutoCorrelation and


CrossCorrelation of a Signal

Number of Programs:1

Aim:
To observe the output waveforms of AutoCorrelated signal and CrossCorrelated Signals

Software Required:
MATLAB.

Theory:

Autocorrelation:
Autocorrelation, also known as serial correlation, is the correlation of a signal with a delayed copy
of itself as a function of delay. Informally, it is the similarity between observations as a function of
the time lag between them. The analysis of autocorrelation is a mathematical tool for finding
repeating patterns, such as the presence of a periodic signal obscured by noise, or identifying the
missing fundamental frequency in a signal implied by its harmonic frequencies. It is often used in
signal processing for analyzing functions or series of values, such as time domain signals.
Different fields of study define autocorrelation differently, and not all of these definitions are
equivalent. In some fields, the term is used interchangeably with autocovariance.
The correlation of a signal with itself is itsautocorrelation:
w(t) =u(t)⊗u(t) =∫∞−∞u∗(τ−t)u(τ)dτ

Cross-correlation
In signal processing, cross-correlation is a measure of similarity of two series as a function of the
displacement of one relative to the other. This is also known as a sliding dot product or sliding
inner-product. It is commonly used for searching a long signal for a shorter, known feature. It has
applications in pattern recognition, single particle analysis, electron tomography, averaging,
cryptanalysis, and neurophysiology. The cross-correlation is similar in nature to the convolution of
two functions. In an autocorrelation, which is the cross-correlation of a signal with itself, there
will always be a peak at a lag of zero, and its size will be the signal energy.
w(t) =u(t)⊗v(t),∫∞−∞u∗(τ)v(τ+t)dτ=∫∞−∞u∗(τ−t)v(τ)dτ
Procedure:
⮚ Switch on the system with MATLAB tool.
⮚ Launch MATLAB software by clicking on MATLAB icon on the desktop.
⮚ Create new program from NEW option in FILE menu.
⮚ Write the program in TEXT EDITOR window.
⮚ Save the program with .m extension.
⮚ Run the program from the EDITOR menu or by pressing F5.
⮚ Check the COMMAND window for output values/errors.If any errors are there,debug the
errors,modify the program,and go to step 6.
⮚ Observe the text outputs in command window and graphical outputs in FIGURES.
⮚ Close the MATLAB tool properly.

BS LAB 61 ECE-CEH-JNTUH
0
2021-22 Std.Id:20011A0403

⮚ Switch off the system.

Program: AutoCorrelation and CrossCorrelation of a Signal:


clc;
close all;
clear all;t=0:0.01:2*pi;
x=sin(t)
y=cos(t)
u=autocorr(x)
v=xcorr(x,y)
subplot(3,3,1)
plot(t,x)
title('x');
subplot(3,3,2)
plot(t,y)
title('y');
subplot(3,3,3)
plot(u)
title('autocorr(x)');
subplot(3,3,4)
plot(v)
title('xcorr(x,y)');
nsamp=rand(1,length(x))
y=x+0.3*nsamp-0.15
u=autocorr(x)
v=xcorr(x,y)
subplot(3,3,5)
plot(t,nsamp)
title('noise data');
subplot(3,3,6)
plot(t,x)
title('original signal x');
subplot(3,3,7)
plot(t,y)
title('x with added noise y');
subplot(3,3,8)
plot(u)
title('autocorr(x)');
subplot(3,3,9)
plot(v)
title('xcorr(x,y)');

Output:

BS LAB 70 ECE-CEH-JNTUH
2021-22 Std.Id:20011A0403

Result:
Hence the output waveforms of AutoCorrelated signal and CrossCorrelated Signals are
observed.
.

BS LAB 71 ECE-CEH-JNTUH
2021-22 Std.Id:20011A0403

Experiment No:16 Date:

Name of the Experiment: Generation of Gaussian Noise and


Extracting its Parameters

Number of Programs:1

Aim:
To generate the gaussian noise and to study about its pdf,mean,variance,skewness,kurtosis
parameters and to observe the output signals.

Software Required:
MATLAB.

Theory:
Gaussian noise is statistical noise that has a probability density function (abbreviated
pdf) of the normal distribution (also known as Gaussian distribution). In other words, the
valuestha the noise can take on are Gaussian-distributed. It is most commonly used as
additive white noise to yield additive white Gaussian noise (AWGN).Gaussian noise is
properly defined as the noise with a Gaussian amplitude distribution. says nothing of the
correlation of the noise in time or of the spectral density of the noise. Labeling Gaussian
noise as 'white' describes the correlation of the noise. It is necessary to use the term "white
Gaussian noise" to be correct. Gaussian noise is sometimes misunderstood to be white
Gaussian noise, but this is not the case.

Formula:
Gaussian Noise,
—(x—μ)2
1
𝑓x(𝑥) = 2πσ
𝑒 2σ2

where 𝜇= mean
𝜎 = 𝑆𝑡𝑎𝑛𝑑𝑎𝑟𝑑 𝐷𝑒𝑣𝑖𝑎𝑡𝑖𝑜𝑛
𝜎2 = 𝑣𝑎𝑟𝑖𝑎𝑛𝑐𝑒

MATLAB command:

P = normpdf(x,yMu,ysigma)

Procedure:
⮚ Switch on the system with MATLAB tool.
⮚ Launch MATLAB software by clicking on MATLAB icon on the desktop.
⮚ Create new program from NEW option in FILE menu.
⮚ Write the program in TEXT EDITOR window.
⮚ Save the program with .m extension.
⮚ Run the program from the EDITOR menu or by pressing F5.

BS LAB 72 ECE-CEH-JNTUH
2021-22 Std.Id:20011A0403

⮚ Check the COMMAND window for output values/errors.If any errors are there,debug the
errors,modify the program,and go to step 6.
⮚ Observe the text outputs in command window and graphical outputs in FIGURES.
⮚ Close the MATLAB tool properly.
⮚ Switch off the system.

Program: Generation of Gaussian Noise and Extracting its Parameters:


clc;
clear all;
close all;
t=0:0.1:20-0.01;
s=sin(t);
x=randn(1,200);
ymu=mean(x);
ymse=sum(x.^2)/length(x);
ysigma=std(x);
yvar=var(x);
yskew=skewness(x);
ykurt0=kurtosis(x);
p=normpdf(x,ymu,ysigma);
subplot(2,2,1);
plot(x,'.');
title('scatter plot of gaussian distribution');
subplot(2,2,2);
area(x,p);
title(' gaussian noise distribution');
subplot(2,2,3);
area(t,s);
title('sin signal without noise');
subplot(2,2,4);
area(t,s+0.3*x-0.15);
title('sin signal with added noise');

Output:

BS LAB 73 ECE-CEH-JNTUH
2021-22 Std.Id:20011A0403

Result:
Hence the the gaussian noise is generated and its pdf,mean,variance,skewness,kurtosis
parameters are studied and output signals are observed.

BS LAB 74 ECE-CEH-JNTUH
2021-22 Std.Id:20011A0403

Experiment No:17 Date:

Name of the Experiment: Finding the Unit Impulse,Unit Step and


Sine Wave response of a LTI system

Number of Programs:1

Aim:
To observe the Unit Impulse,Unit Step and Sine Wave response waveforms of a given LTI
system

Software Required:
MATLAB.

Theory:
A discrete time system performs an operation on an input signal based on predefined criteria
to produce a modified output signal. The input signal x(n) is the system excitation, and y(n) is
the system response. The transform operation is shown as,

If the input to the system is unit impulse i.e. x(n) = δ(n) then the output of the system is
known as impulse response denoted by h(n) where,
h(n) = T[δ(n)]
we know that any arbitrary sequence x(n) can be represented as a weighted sum of discrete
impulses. Now the system response is given by,

Y[n]=T[x(n)] - 𝑥 (𝑘 )𝛿 (𝑛 − 𝑘 )]
k=–∞
T[∑∞

For linear system (1) reduces to

Y[n]= 𝑥(𝑘)𝑇[𝛿(𝑛 − 𝑘)]


k=–∞
∑∞

%given difference equation y(n)-y(n-1)+.9y(n-2)=x(n);


∑N bkX(n–k)
H(Z)= K=0
∑N
K=1 akX(n–k)

b0+b1z—1+⋯bn1z(n—1)+bnz—n
H(z)=1+a1z—1+a1z—1+⋯an1z(n—1)+anz—n

Procedure:
⮚ Switch on the system with MATLAB tool.
BS LAB 75 ECE-CEH-JNTUH
2021-22 Std.Id:20011A0403
⮚ Launch MATLAB software by clicking on MATLAB icon on the desktop.

BS LAB 76 ECE-CEH-JNTUH
2021-22 Std.Id:20011A0403

⮚ Create new program from NEW option in FILE menu.


⮚ Write the program in TEXT EDITOR window.
⮚ Save the program with .m extension.
⮚ Run the program from the EDITOR menu or by pressing F5.
⮚ Check the COMMAND window for output values/errors.If any errors are there,debug the
errors,modify the program,and go to step 6.
⮚ Observe the text outputs in command window and graphical outputs in FIGURES.
⮚ Close the MATLAB tool properly.
⮚ Switch off the system.

Program : Unit Impulse,Unit Step and Sine Wave response waveforms of a given LTI system
clc;
clear all;
close all;
b=[1];
a=[1,-1,.9];
zplane(b,a);
n=0:3:100;
t=0:0.1:2*pi;
x1=(n==0);
x2=(n>0);
x3=sin(t);
y1=filter(b,a,x1);
y2=filter(b,a,x2);
y3=filter(b,a,x3);
figure;
subplot(3,1,1);stem(n,y1);
xlabel('n');ylabel('y1');title('impulse response');
subplot(3,1,2);stem(n,y2);
xlabel('n');ylabel('y2');title('step response');
subplot(3,1,3);stem(t,y3);
xlabel('t');ylabel('y3');title('sin response');

Output :

BS LAB 77 ECE-CEH-JNTUH
2021-22 Std.Id:20011A0403

Result:
Hence the Unit Impulse,Unit Step and Sine Wave response waveforms of a given LTI system
are observed.

BS LAB 78 ECE-CEH-JNTUH
2021-22 Std.Id:20011A0403

Experiment No:18 Date:

Name of the Experiment: Finding the Energy and Power of a Signal


and Signal Classification

Number of Programs:3

Aim:
To find the energy and power of a signal and to classify the signal as power signal,energy
signal,neither energy nor power signal.

Software Required:
MATLAB.

Theory:
Consider a resistor of R ohms with the current passing through it is i (t), then the voltage across the
resistor is V (t) = i (t)*R. The instantaneous power dissipated in the resistor is
P = V2(t)/R in terms of voltage signal,
P = i2(t)*R in terms of current signal.

To remove the dependence of resistance and ease the analysis it is customary in signal analysis to
work with one ohm resistor for which both reduce to same form P = V 2(t) = i2(t). Hence the
instantaneous power associated with signal f(t) is defined as P = |f(t)|2.
T
Total energy of a signal f(t) is defined as E = ƒ 𝑥(𝑡)2 𝑑𝑡 as T tends to infinity.
–T

1
Average power is defined as P == T
2T ƒ– 𝑥(𝑡)2𝑑𝑡 as T tends to infinity.
T

Energy Signal:

A signal f(t) is an energy signal if its total energy if finite and non zero. The average power
associated with a energy signal is zero.

Power Signal:

A signal f (t) is a power signal if its average power if finite and non zero. The energy associated
with a power signal is infinite.

Neither Energy signal or Power signals:

Signals which have infinite power and infinite energy are classified neither as energy signals or
power signals

Typically periodic signals and random signals are power signals.

BS LAB 79 ECE-CEH-JNTUH
2021-22 Std.Id:20011A0403

Formulae:
T
Energy=ƒ
–T 𝑥(𝑡)2 𝑑𝑡

Power= 1 T
2T ƒ– 𝑥(𝑡)2𝑑𝑡
T

Calculations:

1. Linear signal(sin(t)): (Power Signal)


Energy=ƒ 𝑠𝑖𝑛(𝑡)2 𝑑𝑡
T –T

T 1–cos (t)
= –T 2 𝑑𝑡
ƒ
1 sin2(t) T
= 2 [𝑡 − 2 ] –T

1 sin2(T) sin2(T)
= 2 [𝑇 − 2 + 𝑇− 2 ]

= 1 [2𝑇 − 𝑠𝑖𝑛2(𝑇)]
2

= 1 [∞ − ∞]
2

=∞
2
Power=A
2 for sinusoidal signals

1
=2

2. Single sided exponential:(Energy Signal)


T
Energy=ƒ
–T
𝑥(𝑡)2 𝑑𝑡


= –∞ 𝑒–2tdt
ƒ

=ƒ0 𝑒–2tdt


e—2t
= –2 0

1
=2

Power= 1 T
2T ƒ– 𝑥(𝑡)2𝑑𝑡
T
BS LAB 71 ECE-CEH-JNTUH
0
2021-22 Std.Id:20011A0403

T 1
=
ƒ 𝑒–2t𝑑𝑡
2T 0

BS LAB 71 ECE-CEH-JNTUH
1
2021-22 Std.Id:20011A0403


1 e—2t
=2T –2 0

=0

3. Double exponential signal(𝑒–t):( Neither Energy nor Power Signal :)

T
Energy=ƒ 𝑥(𝑡)2 𝑑𝑡
–T

=∞
𝑒–2tdt
ƒ
–∞
–2t ∞
=[𝑒 ]–∞
=–1
2
[𝑒–∞ − 𝑒∞]
=∞
Power= 1 ƒT
2T –T 𝑥(𝑡)2𝑑𝑡
1 T
= ƒ–T –2t
2T
𝑒 dt

1 —2t
= [e ]T
2T –2 –T

1
=4T [𝑒–2t − 𝑒2t]
=∞

Procedure:
⮚ Switch on the system with MATLAB tool.
⮚ Launch MATLAB software by clicking on MATLAB icon on the desktop.
⮚ Create new program from NEW option in FILE menu.
⮚ Write the program in TEXT EDITOR window.
⮚ Save the program with .m extension.
⮚ Run the program from the EDITOR menu or by pressing F5.
⮚ Check the COMMAND window for output values/errors.If any errors are there,debug the
errors,modify the program,and go to step 6.
⮚ Observe the text outputs in command window and graphical outputs in FIGURES.
⮚ Close the MATLAB tool properly.
⮚ Switch off the system.

Program-1 :Power Signal :


clc;
clear all;
close all;
syms t;
f=sin(t);

BS LAB 80 ECE-CEH-JNTUH
2021-22 Std.Id:20011A0403

ezplot(t,f,[-pi,pi]);grid on;
e=limit(int(f.^2,-t,t),t,inf);
p=limit(int(f.^2,-t,t)./(t*2),t,inf);
disp('energy of signal=');
disp(e);
disp('power of signal=');
disp(p);
if(p==0)
disp('given signal is energy signal');
title([char(f) ,'is energy signal']);
elseif(e==inf&p~=inf)
disp('given signal is power signal');
title([char(f) ,'is power signal']);
elseif(p==inf&e==inf)
disp('given signal is neither energy nor power signal');
title([char(f) ,'is neither energy nor power signal']);
end

Output-1(i): (Command Window):


energy of signal=
Inf

power of signal=
1/2

given signal is power signal

Output-1(ii):

Program-2 :Energy Signal :

BS LAB 81 ECE-CEH-JNTUH
2021-22 Std.Id:20011A0403

clc;
clear all;
close all;
syms t;
f=exp(-t)*heaviside(t);
ezplot(t,f,[-1,1])
e=limit(int(f.^2,-t,t),t,inf);
p=limit(int(f.^2,-t,t)/(2*t),t,inf);
disp('energy of signal=');
disp(e);
disp('power of signal=');
disp(p);
if(p==0)
disp('given signal is energy signal');
title([char(f),'is energy signal']);
elseif(e==inf&p~=inf)
disp('given signal is power signal');
title([char(f),'is power signal']);
elseif(p==0)
disp('given signal is neither energy nor power signal');
title([char(f),'is neither energy nor power signal']);
end

Output-2(i): (Command Window):


energy of signal=
1/2

power of signal=
0
given signal is energy signal

Output-2(ii):

Program-3 :Neither Energy nor Power Signal :

BS LAB 82 ECE-CEH-JNTUH
2021-22 Std.Id:20011A0403

clc;
clear all;
close all;
syms t;
f=exp(t);
ezplot(t,f,[-1,1])
e=limit(int(f.^2,-t,t),t,inf);
p=limit(int(f.^2,-t,t)./(2*t),t,inf);
disp('energy of signal=');
disp(e);
disp('power of signal=');
disp(p);
if(p==0)
disp('given signal is energy signal');
title([char(f),'is energy signal']);grid on;
elseif(e==inf&p~=inf)
disp('given signal is power signal');
title([char(f),'is power signal']);grid on;
elseif(p==inf&e==inf)
disp('given signal is neither energy nor power signal');
title([char(f),'is neither energy nor power signal']);grid on;
end

Output-3(i): (Command Window):


energy of signal=
Inf

power of signal=
Inf

given signal is neither energy nor power signal

Output-3(ii):

BS LAB 83 ECE-CEH-JNTUH
2021-22 Std.Id:20011A0403

Result:
Hence the the energy and power of a signal are found and signal is classified as power
signal,energy signal,neither energy nor power signal.

BS LAB 84 ECE-CEH-JNTUH
2021-22 Std.Id:20011A0403

Experiment No:19 Date:

Name of the Experiment: Finding Fourier Transform of a Signal and


Plotting Magnitude and Phase Response

Number of Programs:3

Aim:
To find the Fourier Transform of a Signal and to Observe the Waveforms of its Magnitude and
Phase Responses.

Software Required:
MATLAB.

Theory:
The Fourier transform (FT) decomposes a function of time (a signal) into its
constituent frequencies. This is similar to the way a musical chord can be expressed in terms of the
volumes and frequencies of its constituent notes. The term Fourier transform refers to both the
frequency domain representation and the mathematical operation that associates the frequency
domain representation to a function of time.The Fourier transform of a function of time is itself a
complex-valued function of frequency, whose magnitude (modulus) represents the amount of that
frequency present in the original function, and whose argument is the phase offset of the basic
sinusoid in that frequency. The Fourier transform is not limited to functions of time, but the domain
of the original function is commonly referred to as the time domain.There is also an inverse Fourier
transform that mathematically synthesizes the original function from its frequency domain
representation. Linear operations performed in one domain (time or frequency) hae corresponding
operations in the other domain, which are sometimes easier to perform. The operation of
differentiation in the time domain corresponds to multiplication by the frequency, [remark 1] so
some differential equations are easier to analyze in the frequency domain. Also, convolution in the
time domain corresponds to ordinary multiplication in the frequency domain (see Convolution
theorem). After performing the desired operations, transformation of the result can be made back to
the time domain. Harmonic analysis is the systematic study of the relationship between the
frequency and time domains,including the kinds of functions or operations that are
&quot;simpler&quot; in one or the other, and has deep connections to many areas of modern
mathematics.

Derivation:
Let x(t) be a non periodic signal
𝑥T(𝑡) be periodic with period T
Let their relation is given by x(t)=𝑥T(𝑡)
The fourier series of periodic signal 𝑥T(𝑡) is :

𝑥T(𝑡) = Σ 𝐶n𝑒jnw0t
n=–∞
Where
BS LAB 85 ECE-CEH-JNTUH
2021-22 Std.Id:20011A0403
T
𝐶 = 1 f2 𝑥 (𝑡)𝑒–jnw0t𝑑𝑡

n
𝑇 –T
And
2π T2
𝑤0 = T

∴ 𝑇𝐶 = 1 f2
T
𝑥 (𝑡)𝑒–jnw0t𝑑𝑡
n
𝑇 –T
Let 𝑛𝑤0=w at T→ ∞
T2

As T→ ∞ We have 𝑤0 = ( ) → and the discrete fourier spectrum becomes
0 T
continous.
Further ,the summation becomes integral and 𝑥T(𝑡) → 𝑥(𝑡)
Thus ,as T→ ∞
𝑇𝐶 1 T
=2 𝑥 (𝑡)𝑒–jnw0t𝑑𝑡
ƒ
n —T T
T 2

=ƒ –∞ [𝑥T (𝑡) ])𝑒–jwt𝑑𝑡
∞ 𝑥(𝑡)𝑒–jwt𝑑𝑡
=ƒ –∞

∴ X(w)= –∞ 𝑥(𝑡)𝑒–jwt𝑑𝑡
=X(w)

Hence , X(w) is called as fourier transform or the fourier integral of x(t)

Formulae:
X(w)=İ
–∞ 𝑥(𝑡)𝑒–jwt𝑑𝑡

Calculations:
1.sin 𝑤0𝑡:
Given x(t)= sin 𝑤0𝑡
X(w)=F[sin 𝑤0𝑡]
ejw0t–e—jw0t
=F[ 2J ]
=2j [F[𝑒 ]- F[𝑒–jw0t]
1 jw0t

= 1 [2𝜋𝛿(𝜔 − 𝜔 )
2j 0 − 2𝜋𝛿(𝜔 + 𝜔0)]

∴ F[sin 𝑤0𝑡]=-j𝜋[𝛿(𝜔 − 𝜔0) − 𝛿(𝜔 + 𝜔0)]


=-j𝜋[𝛿(𝜔 − 𝜔0) − 𝛿(𝜔 + 𝜔0)]

BS LAB 86 ECE-CEH-JNTUH
2021-22 Std.Id:20011A0403
Procedure:
⮚ Switch on the system with MATLAB tool.
⮚ Launch MATLAB software by clicking on MATLAB icon on the desktop.

BS LAB 87 ECE-CEH-JNTUH
2021-22 Std.Id:20011A0403

⮚ Create new program from NEW option in FILE menu.


⮚ Write the program in TEXT EDITOR window.
⮚ Save the program with .m extension.
⮚ Run the program from the EDITOR menu or by pressing F5.
⮚ Check the COMMAND window for output values/errors.If any errors are there,debug the
errors,modify the program,and go to step 6.
⮚ Observe the text outputs in command window and graphical outputs in FIGURES.
⮚ Close the MATLAB tool properly.
⮚ Switch off the system.

Program-1: Fourier Transform of Signal-1:


clc
clear all
close all
syms t
x=2*(heaviside(t+1)-heaviside(t-1))
x1=simplify(x)
y=fourier(x1)
y1=simplify(y)
m=sqrt(real(y1)^2+imag(y1)^2)
p=angle(y1)
subplot(2,3,1) ezplot(x,
[-3,3,-1,3])
subplot(2,3,2) ezplot(y,
[-20,20,-5,10])
subplot(2,3,3) ezplot(y1,
[-20,20,-5,10])
subplot(2,3,4) ezplot(m,
[-20,20,-5,10])
subplot(2,3,5)
ezplot(p,[-20,20,-1,4])

Output-1(i):(Command Window):
x=

2*heaviside(t + 1) - 2*heaviside(t - 1)

x1 =

2*heaviside(t + 1) - 2*heaviside(t - 1)

y=

- 2*exp(-w*1i)*(pi*dirac(w) - 1i/w) + 2*exp(w*1i)*(pi*dirac(w) - 1i/w)

y1 =

(4*sin(w))/w

BS LAB 88 ECE-CEH-JNTUH
2021-22 Std.Id:20011A0403

m=

4*(imag(sin(w)/w)^2 + real(sin(w)/w)^2)^(1/2)

p=

angle(sin(w)/w)

Output-1(ii):

Program-2: Fourier Transform of Signal-2:


clc
clear all
close all
syms t
x=2*(heaviside(t+2)-heaviside(t-2))
x1=simplify(x)
y=fourier(x1)
y1=simplify(y)
m=sqrt(real(y1)^2+imag(y1)^2)
p=angle(y1)
subplot(2,3,1);ezplot(x,[-6,6,-1,3])
subplot(2,3,2);ezplot(y,[-6,6,-5,10])
subplot(2,3,3);ezplot(y1,[-6,6,-5,10])
subplot(2,3,4);ezplot(m,[-6,6,-5,10])
subplot(2,3,5);ezplot(p,[-6,6,-1,4])

Output-2(i):(Command Window):
x=

2*heaviside(t + 2) - 2*heaviside(t - 2)

x1 =

2*heaviside(t + 2) - 2*heaviside(t - 2)

BS LAB 89 ECE-CEH-JNTUH
2021-22 Std.Id:20011A0403

y=

- 2*exp(-w*2i)*(pi*dirac(w) - 1i/w) + 2*exp(w*2i)*(pi*dirac(w) - 1i/w)

y1 =

(4*sin(2*w))/w

m=

4*(imag(sin(2*w)/w)^2 + real(sin(2*w)/w)^2)^(1/2)

p=

angle(sin(2*w)/w)

Output-2(ii):

Program-3: Fourier Transform of Signal-3:


clc;
clear all;
close all;
syms t;
x=2*(heaviside(t+4)-heaviside(t-4));
x1=simplify(x);
y=fourier(x1);
y1=simplify(y);
m=sqrt(real(y1)^2+imag(y1)^2);
p=angle(y1);
subplot(2,3,1);ezplot(x,[-6,6,-1,3]);
subplot(2,3,2);ezplot(y,[-6,6,-5,20]);
subplot(2,3,3);ezplot(y1,[-6,6,-5,20]);
subplot(2,3,4);ezplot(m,[-6,6,-5,20]);
subplot(2,3,5);ezplot(p,[-6,6,-1,6]);

Output-3(i):(Command Window):
x=

2*heaviside(t + 4) - 2*heaviside(t - 4)

BS LAB 81 ECE-CEH-JNTUH
0
2021-22 Std.Id:20011A0403

y=

- 2*exp(-w*4i)*(pi*dirac(w) - 1i/w) + 2*exp(w*4i)*(pi*dirac(w) - 1i/w)

y1 =

(4*sin(4*w))/w

m=

4*(imag(sin(4*w)/w)^2 + real(sin(4*w)/w)^2)^(1/2)

p=

angle(sin(4*w)/w)

Output-3(ii):

Program-4: Fourier Transform of Signal-4:


clc
clear all
close all
syms t
x=(2*(t+2)).*(heaviside(t+2)-heaviside(t))+(-2*t+4).*(heaviside(t)-heaviside(t-2))
x1=simplify(x)
y=fourier(x1)
y1=simplify(y)
m=sqrt(real(y1)^2+imag(y1)^2)
p=angle(y1)
subplot(2,3,1)
ezplot(x,[-6,6,-1,5])
subplot(2,3,4)
ezplot(y,[-6,6,-5,10])
subplot(2,3,5)
ezplot(y1,[-6,6,-5,10])

BS LAB 90 ECE-CEH-JNTUH
2021-22 Std.Id:20011A0403

subplot(2,3,3)
ezplot(m,[-6,6,-5,10])
subplot(2,3,6)
ezplot(p)

Output-4(i):(Command Window):
x=

(2*t - 4)*(heaviside(t - 2) - heaviside(t)) + (2*t + 4)*(heaviside(t + 2) - heaviside(t))

x1 =

(2*t - 4)*(heaviside(t - 2) - heaviside(t)) + (2*t + 4)*(heaviside(t + 2) - heaviside(t))

y=

4/w^2 + exp(-w*2i)*(pi*dirac(1, w) + 1i/w^2)*2i + exp(w*2i)*(pi*dirac(1, w) + 1i/w^2)*2i -


pi*dirac(1, w)*4i

y1 =

-(2*exp(-w*2i)*(exp(w*2i) - 1)^2)/w^2

m=

2*(imag((exp(-w*2i)*(exp(w*2i) - 1)^2)/w^2)^2 + real((exp(-w*2i)*(exp(w*2i) -


1)^2)/w^2)^2)^(1/2)

p=

angle(-(exp(-w*2i)*(exp(w*2i) - 1)^2)/w^2)

Output-4(i):

Program-5: Fourier Transform of Signal-5:


clc

BS LAB 91 ECE-CEH-JNTUH
2021-22 Std.Id:20011A0403

clear all
close all
syms t
x=(t+4).*(heaviside(t+4)-heaviside(t))+((-1)*(t-4)).*(heaviside(t)-heaviside(t-4))
x1=simplify(x)
y=fourier(x1)
y1=simplify(y)
m=sqrt(real(y1)^2+imag(y1)^2)
p=angle(y1)
subplot(2,3,1);ezplot(x,[-6,6,-1,5])
subplot(2,3,4);ezplot(y,[-6,6,-5,20])
subplot(2,3,5);ezplot(y1,[-6,6,-5,20])
subplot(2,3,3);ezplot(m,[-6,6,-5,20])
subplot(2,3,6);ezplot(p)

Output-5(i):(Command Window):
x=

(t - 4)*(heaviside(t - 4) - heaviside(t)) + (t + 4)*(heaviside(t + 4) - heaviside(t))

x1 =

(t - 4)*(heaviside(t - 4) - heaviside(t)) + (t + 4)*(heaviside(t + 4) - heaviside(t))

y=

2/w^2 + exp(-w*4i)*(pi*dirac(1, w) + 1i/w^2)*1i + exp(w*4i)*(pi*dirac(1, w) + 1i/w^2)*1i -


pi*dirac(1, w)*2i

y1 =

-(exp(-w*4i)*(exp(w*4i) - 1)^2)/w^2

m=

(imag((exp(-w*4i)*(exp(w*4i) - 1)^2)/w^2)^2 + real((exp(-w*4i)*(exp(w*4i) -


1)^2)/w^2)^2)^(1/2)

p=

angle(-(exp(-w*4i)*(exp(w*4i) - 1)^2)/w^2)

Output-5(i):

BS LAB 92 ECE-CEH-JNTUH
2021-22 Std.Id:20011A0403

Result:
Hence the Fourier Transform of a Signal is found and Waveforms of its Magnitude and Phase
Responses are observed.

BS LAB 93 ECE-CEH-JNTUH
2021-22 Std.Id:20011A0403

Experiment No:20 Date:

Name of the Experiment: Finding Laplace Transform of a Signal and


Plotting Location of Poles and Zeros

Number of Programs:3

Aim:
To find the Laplace Transform of a Signal and to plot and determine the Location of Poles ans
Zeros

Software Required:
MATLAB.

Theory:
The Laplace transform can be used to solve differential equations.
Besides being a different and efficient alternative to variation of
parameters and undetermined coefficients, the Laplace method is
particularly advantageous for input terms that are piecewise-
defined, periodic or impulsive. The direct Laplace transform or the
Laplace integral of a function f(t) defined for 0 ≤ t &lt; ∞ is the
ordinary calculus integration L–notation recognizes that
integration always proceeds over t = 0 to t = ∞ and that the
integral involves an integrator instead of the usual dt. These
minor differences
distinguish Laplace integrals from the ordinary integrals found on the inside covers of calculus
texts. Lerch’s law, the formal rule of erasing the integral signs is valid provided the integrals
are equal for large s and certain conditions hold on y and

Derivation:
The fourier transform of a continous time signal signal x(t) can be represented as

X(w)=ƒ– 𝑥(𝑡)𝑒–jwt𝑑𝑡

Where

1 ∞
X(t)= ƒ 𝑥(𝑤)𝑒–jwt𝑑𝑤
2π –∞

Including the convergence factor by replacing w by 𝜎 + 𝑗𝑤,we have



X(𝜎 + 𝑗𝑤)=ƒ– 𝑋(𝜎 + 𝑗𝑤)𝑒–(σ+jw)t𝑑𝑡

And X(t) can be expressed as:


1
X(𝑡)= ∞
ƒ–
2π 𝑋(𝜎 + 𝑗𝑤)𝑒–(σ+jw)t𝑑𝑤

BS LAB 94 ECE-CEH-JNTUH
2021-22 Std.Id:20011A0403
ds ds
The complex frequency term 𝜎 + 𝑗𝑤 is denoted by s.then,( )=j or dw=( )
dw
j

Substituting these values in equation for X(s),we get



X(s)=ƒ 𝑥(𝑡)𝑒–st𝑑𝑡

Formulae:

X(s)=ƒ– 𝑥(𝑡)𝑒–st𝑑𝑡

Calculation:

X(s) = L[sin wt u(t)]


ejwt–e—jwt
=L[ 2
u(t)]
1 jwt 1 –jwt
= L[𝑒 𝑢(𝑡)]- L[ 𝑢(𝑡)]
2 𝑒
2
1 1 1 1
= ( )- ( )
2 s–jw 2 s+jw
1 s+jw–s+jw
= [ ]
2 ( s+jw)(s–jw)
= w 2 2
s +w

W
Sin wt u(t) 𝐿𝑇 ¯
S 2 +W 2

Procedure:
⮚ Switch on the system with MATLAB tool.
⮚ Launch MATLAB software by clicking on MATLAB icon on the desktop.
⮚ Create new program from NEW option in FILE menu.
⮚ Write the program in TEXT EDITOR window.
⮚ Save the program with .m extension.
⮚ Run the program from the EDITOR menu or by pressing F5.
⮚ Check the COMMAND window for output values/errors.If any errors are there,debug the
errors,modify the program,and go to step 6.
⮚ Observe the text outputs in command window and graphical outputs in FIGURES.
⮚ Close the MATLAB tool properly.
⮚ Switch off the system.

Program-1: Laplace Transform of Signal-1:


clc
clear all
close all
BS LAB 95 ECE-CEH-JNTUH
2021-22 Std.Id:20011A0403

syms t
f=sin(t)
L=laplace(f)
L1=collect(L)
[num,den]=numden(L1)
transform=tf(sym2poly(num),sym2poly(den),0.001)
subplot(2,2,1)
ezplot(t,f)
subplot(2,2,2)
ezplot(L)
subplot(2,2,3)
ezplot(L1)
subplot(2,2,4)
pzmap(transform)

Output-1(i):(Command Window):
f=

sin(t)

L=

1/(s^2 + 1)

L1 =

1/(s^2 + 1)

num =

den =

s^2 + 1

transform =

z^2 + 1

Sample time: 0.001 seconds

Discrete-time transfer function.

Output-1(i):

BS LAB 96 ECE-CEH-JNTUH
2021-22 Std.Id:20011A0403

Program-2: Laplace Transform of Signal-2:


clc
clear all
close all
syms t
f=cos(t)
L=laplace(f)
L1=collect(L)
[num,den]=numden(L1)
transform=tf(sym2poly(num),sym2poly(den),0.001)
subplot(2,2,1)
ezplot(t,f)
subplot(2,2,2)
ezplot(L)
subplot(2,2,3)
ezplot(L1)
subplot(2,2,4)
pzmap(transform)

Output-2(i):(Command Window):
f=

cos(t)

L=

s/(s^2 + 1)

L1 =

s/(s^2 + 1)

num =

den =

BS LAB 97 ECE-CEH-JNTUH
2021-22 Std.Id:20011A0403

s^2 + 1

transform =

z^2 + 1

Sample time: 0.001 seconds

Discrete-time transfer function.

Output-2(ii):

Program-3: Laplace Transform of Signal-3:


clc
clear all
close all
syms t
f=heaviside(t)
l=laplace(f)
l1=collect(l)
[num,den]=numden(l1)
transform=tf(sym2poly(num),sym2poly(den),0.001)
subplot(2,2,1)
ezplot(t,f)
subplot(2,2,2)
ezplot(l)
subplot(2,2,3)
ezplot(l1)
subplot(2,2,4)
pzmap(transform)

Output-3(i):(Command Window):
f=

BS LAB 98 ECE-CEH-JNTUH
2021-22 Std.Id:20011A0403

heaviside(t)

l=

1/s

l1 =

1/s

num =

den =

transform =

Sample time: 0.001 seconds

Discrete-time transfer function.

Output-3(ii):

Result:
Hence the Laplace Transform of a Signal is found and the Location of Poles ans Zeros are
plotted and determined

BS LAB 99 ECE-CEH-JNTUH
2021-22 Std.Id:20011A0403

Experiment No:21 Date:

Name of the Experiment: Finding Z-Transform of a Signal and


Plotting Location of Poles and Zeros

Number of Programs:3

Aim:
To find the Z-Transform of a Signal and to plot and determine the Location of Poles ans Zeros

Software Required:
MATLAB.

Theory:
In the study of discrete-time signal and systems, we have thus far considered the time-domain
and the frequency domain. The z domain gives us a third representation. All three domains are
related to each other. A special feature of the z-transform is that for the signals and system of
interest to us, all of the analysis will be in terms of ratios of polynomials. Working with these
polynomials is relatively straight forward.
Definition of the z-Transform
• This transformation produces a new representation of denoted
• Returning to the original sequence (inverse z-transform) requires finding the
coefficient associated with the nth power.
– In the sequence or n-domain the independent variable is n
– In the z-domain the independent variable is z

Derivation:
The discrete time fouriertransform of a sequence x(n) is given by

X(w)=∑∞
n=–∞ 𝑥(𝑛)𝑒–jwn

For the existence of DTFT ,the above summation should converge ,i.e x(n) must be
absolutely summable.
The z transform of the sequence x(n) is given by

Z[x(n)]=X(z)
= ∑∞n=–∞ 𝑥(𝑛)𝑧–n

Where z is a complex variable and is given by


Z=r𝑒jw
Where r is radius of circle

Formulae:

BS LAB 100 ECE-CEH-JNTUH


2021-22 Std.Id:20011A0403

Z[x(n)]= ∑∞
n=–∞ 𝑥(𝑛)𝑧–n

Calculations:
X(n)=sin wn u(n)
=sin wn for n≥ 0

∴ 𝑋(𝑧) = 𝑧[𝑠𝑖𝑛 𝑠𝑖𝑛 𝑤𝑛𝑢(𝑛) ]


=0 for n<0


=1∑n=0 𝑠𝑖𝑛 𝑠𝑖𝑛 𝑤𝑛 𝑧–n
= ∑∞
n=0 1(𝑒jwn𝑧–n − 𝑒–jwn𝑧–n)
2j
=∑ (z—1ejw)n–(z—1e—jw)n
∞ 1
n=0 2j
=∑∞ (z—1ejw)n ∞ (z—1e—jw)n
n=0 1 2j − ∑n=0 1 2j

The above series converges for |𝑧−1|<1, i.e |𝑧|1 > 1


X(z)= 1 ( 1
− )
2j 1–z—1ejw 1–z —1e—jw
1
1 z − )
= 2j(z–ejw 1–e—j

zsin zsin w
Sin wnu(n) 𝑍𝑇¯ =z2–2zco w+1
w

Procedure: z2–2zcos w+1


⮚ Switch on the system with MATLAB tool.
⮚ Launch MATLAB software by clicking on MATLAB icon on the desktop.
⮚ Create new program from NEW option in FILE menu.
⮚ Write the program in TEXT EDITOR window.
⮚ Save the program with .m extension.
⮚ Run the program from the EDITOR menu or by pressing F5.
⮚ Check the COMMAND window for output values/errors.If any errors are there,debug the
errors,modify the program,and go to step 6.
⮚ Observe the text outputs in command window and graphical outputs in FIGURES.
⮚ Close the MATLAB tool properly.
⮚ Switch off the system.

Program-1: Z-Transform of Signal-1:


clc;clear all;close all;
syms n;
f=sin(n)
F=ztrans(f)
f1=collect(F)
[num,den]=numden(f1)
h=tf(sym2poly(num),sym2poly(den))
subplot(2,2,1);ezplot(n,f);
BS LAB 101 ECE-CEH-JNTUH
2021-22 Std.Id:20011A0403

subplot(2,2,2);ezplot(F);
subplot(2,2,3);ezplot(f1);
subplot(2,2,4);pzmap(h);

Output-1(i):(Command Window):
f=

sin(n)

F=

(z*sin(1))/(z^2 - 2*cos(1)*z + 1)

f1 =

(sin(1)*z)/(z^2 - 2*cos(1)*z + 1)

num =

z*sin(1)

den =

z^2 - 2*cos(1)*z + 1

h=

0.8415 s

s^2 - 1.081 s + 1

Continuous-time transfer function.

Output-1(ii):

Program-2: Z- Transform of Signal-2:

BS LAB 102 ECE-CEH-JNTUH


2021-22 Std.Id:20011A0403

clc;clear all;close all;


syms n;
f=cos(n)
F=ztrans(f)
f1=collect(F)
[num,den]=numden(f1)
h=tf(sym2poly(num),sym2poly(den))
subplot(2,2,1);ezplot(n,f);
subplot(2,2,2);ezplot(F);
subplot(2,2,3);ezplot(f1);
subplot(2,2,4);pzmap(h);

Output-2(i):(Command Window):
f=

cos(n)

F=

(z*(z - cos(1)))/(z^2 - 2*cos(1)*z + 1)

f1 =

(z^2 - cos(1)*z)/(z^2 - 2*cos(1)*z + 1)

num =

z^2 - cos(1)*z

den =

z^2 - 2*cos(1)*z + 1

h=

s^2 - 0.5403 s

s^2 - 1.081 s + 1

Continuous-time transfer function.

Output-2(ii):

BS LAB 103 ECE-CEH-JNTUH


2021-22 Std.Id:20011A0403

Program-3: Z-Transform of Signal-3:


clc;clear all;close all;
syms n;
f=heaviside(n)
F=ztrans(f)
f1=collect(F)
[num,den]=numden(f1)
h=tf(sym2poly(num),sym2poly(den))
subplot(2,2,1);ezplot(n,f);
subplot(2,2,2);ezplot(F);
subplot(2,2,3);ezplot(f1);
subplot(2,2,4);pzmap(h);

Output-3(i):(Command Window):
f=

heaviside(n)

F=

1/(z - 1) + 1/2

f1 =

(z + 1)/(2*z - 2)

num =

den =

2*z - 2

h=

BS LAB 104 ECE-CEH-JNTUH


2021-22 Std.Id:20011A0403

s+1

2s-2

Continuous-time transfer function.

Output-3(ii):

Result:
Hence the Z-Transform of a Signal is found and the Location of Poles ans Zeros are plotted
and determined

BS LAB 105 ECE-CEH-JNTUH

You might also like