Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
3 views6 pages

DSP2

The lab report details the generation and manipulation of discrete sinusoidal and cosine signals using MATLAB, focusing on operations such as time-shifting, folding, and time scaling. Results show successful signal generation and manipulation, demonstrating the effects of each operation on the signals. The lab concludes that these fundamental operations are crucial for advanced digital signal processing techniques.

Uploaded by

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

DSP2

The lab report details the generation and manipulation of discrete sinusoidal and cosine signals using MATLAB, focusing on operations such as time-shifting, folding, and time scaling. Results show successful signal generation and manipulation, demonstrating the effects of each operation on the signals. The lab concludes that these fundamental operations are crucial for advanced digital signal processing techniques.

Uploaded by

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

Digital Signal Processing Lab Report

Signal Generation and Basic Operations

Tanjim Jahan Joy


August 2, 2025

Objective
The objective of this lab is to:

• Generate discrete sinusoidal and cosine signals.

• Perform basic operations on discrete-time signals including time-shifting, folding


(time reversal), and time scaling.

Task 1: Generate a discrete sinusoidal signal and per-


form the following operations.
Signal Definition:
x(n) = A · sin(ωn + ϕ)
Where:

• A = 1 (Amplitude)

• ω= π
4
(Frequency)

• ϕ = 0 (Phase)

• n = −10 to 10

MATLAB Code:
t = -2* pi : 0.5 : 2* pi ;
x = sin ( t ) ;
subplot (2 ,2 ,1) ;
stem (t ,x , ’b ’ , ’ filled ’) ;
xlabel ( ’t ’) ;
ylabel ( ’ sin ( t ) ’) ;
title ( ’ Discrete sine wave ’) ;

1
(a) Time Shifting: sin(n − 3)
t = -2* pi : 0.5 : 2* pi ;
tShifted = t + pi *2;
subplot (2 ,2 ,2) ;
stem ( tShifted , x , ’b ’ , ’ filled ’) ;
xlabel ( ’t ’) ;
ylabel ( ’ sin (t -3) ’) ;
title ( ’ Time Shifted ’)

(b) Folding: sin(−n)


t = -2* pi : 0.5 : 2* pi ;
xFolded = sin ( - t ) ;
subplot (2 ,2 ,3) ;
stem (t , xFolded , ’b ’ , ’ filled ’) ;
xlabel ( ’t ’) ;
ylabel ( ’ sin ( - t ) ’) ;
title ( ’ Folded ’) ;

(c) Time Scaling: sin(3n)


t = -2* pi : 0.5 : 2* pi ;
xScaled = 3* x ;
subplot (2 ,2 ,4) ;
stem (t , xScaled , ’b ’ , ’ filled ’) ;
xlabel ( ’t ’) ;
ylabel ( ’ sin (3 t ) ’) ;
title ( ’ Scaled Signal ’) ;

Figure 1

2
Task 2: Generate a discrete cosine signal and perform
the following operations.
Signal Definition:
x(n) = A · cos(ωn + ϕ)
Where:

• A = 1 (Amplitude)

• ω= π
4
(Frequency)

• ϕ = 0 (Phase)

• n = −10 to 10

MATLAB Code:
t = -2* pi : 0.5 : 2* pi ;
y = cos ( t ) ;
subplot (2 ,2 ,1) ;
stem (t ,y , ’b ’ , ’ filled ’) ;
xlabel ( ’t ’) ;
ylabel ( ’ cos ( t ) ’) ;
title ( ’ Discrete cosine wave ’) ;

(a) Time Shifting: cos(n − 3)


t = -2* pi : 0.5 : 2* pi ;
tShifted = t + pi *2;
subplot (2 ,2 ,2) ;
stem ( tShifted , x , ’b ’ , ’ filled ’) ;
xlabel ( ’t ’) ;
ylabel ( ’ cos (t -3) ’) ;
title ( ’ Time Shifted ’)

(b) Folding: cos(−n)


t = -2* pi : 0.5 : 2* pi ;
yFolded = cos ( - t ) ;
subplot (2 ,2 ,3) ;
stem (t , yFolded , ’b ’ , ’ filled ’) ;
xlabel ( ’t ’) ;
ylabel ( ’ cos ( - t ) ’) ;
title ( ’ Folded ’) ;

3
(c) Time Scaling: cos(3n)
t = -2* pi : 0.5 : 2* pi ;
yScaled = 3* y ;
subplot (2 ,2 ,4) ;
stem (t , yScaled , ’b ’ , ’ filled ’) ;
xlabel ( ’t ’) ;
ylabel ( ’ cos (3 t ) ’) ;
title ( ’ Scaled Signal ’) ;

Figure 2

Task 3: Generate a signal z(n) and perform the fol-


lowing operations, where the value of 0 indicates the
starting position.
z = [1, −3, 4, −5, 0, 2, 3, 5, −7];
Index n = 0 corresponds to the 5th element (value = 0). Thus:

n = −4 to 4

MATLAB Code:
z = [1 , -3 , 4 , -5 , 0 , 2 , 3 , 5 , -7];
n = -4:1:4;
subplot (2 ,2 ,1) ;
stem (n ,z , ’b ’ , ’ filled ’) ;
xlabel ( ’n ’) ;
ylabel ( ’z ’) ;
title ( ’ Discrete Value ’) ;

(a) Time Shifting: z(n − 3)


z = [1 , -3 , 4 , -5 , 0 , 2 , 3 , 5 , -7];
n = -4:1:4;
nShifted = n -3;

4
subplot (2 ,2 ,2) ;
stem ( nShifted ,z , ’b ’ , ’ filled ’) ;
xlabel ( ’n -3 ’) ;
ylabel ( ’z ’) ;
title ( ’ Shifted Value ’) ;

(b) Folding: z(−n)


z = [1 , -3 , 4 , -5 , 0 , 2 , 3 , 5 , -7];
zFolded = -z ;
n = -4:1:4;
subplot (2 ,2 ,3) ;
stem (n , zFolded , ’b ’ , ’ filled ’) ;
xlabel ( ’n ’) ;
ylabel ( ’ -z ’) ;
title ( ’ Folded Value ’) ;

(c) Time Scaling: z(3n)


z = [1 , -3 , 4 , -5 , 0 , 2 , 3 , 5 , -7];
zScaled = 3* z ;
n = -4:1:4;
subplot (2 ,2 ,4) ;
stem (n , zScaled , ’b ’ , ’ filled ’) ;
xlabel ( ’n ’) ;
ylabel ( ’ 3* z ’) ;
title ( ’ Scaled Value ’) ;

Figure 3

Results and Discussion


• Discrete sinusoidal and cosine signals were generated successfully.

• Time shifting (x(n − 3)) moved the signal to the right by 3 samples.

5
• Folding (x(−n)) reversed the time axis of the signal.

• Time scaling (x(3n)) resulted in compression, retaining every third sample.

Conclusion
This lab demonstrated the generation and manipulation of discrete-time signals. These
fundamental signal operations—shifting, folding, and scaling—are essential in digital sig-
nal processing and serve as the basis for more advanced techniques such as filtering and
transformation.

References
1. MATLAB Documentation - https://www.mathworks.com/help/

You might also like