DSP LAB REPORT 2
DSP LAB REPORT 2
Lab # 2
NAME M.OBAID TAHIR
CLASS/SECTION BEE-6A
OUTPUT:
EXPLANATION:
In this task, an exponential signal is generated and scaled using MATLAB. The time variable is
defined, and an exponential function is created. A negative scaling factor is applied to modify the
signal. The output consists of two graphs: the first shows the original exponential signal, and the
second displays the scaled version. The scaling operation affects the amplitude of the signal,
demonstrating how an exponential function behaves under transformation. This experiment helps
in understanding signal scaling and its impact on amplitude variations in discrete-time signal
processing
In Lab Task 2:
Write a MATLAB function ‘sigshift’ for producing a delay of ‘k’ in a given sequence ‘x[n]’
defined by arrays ‘x’ and ‘n’ by using the pseudo code given in In-Lab Work section. Your
function should yield y[n] = x [n-k].
Function [y,n]=sigshift(x,n,k)
MATLAB CODE:
FUNCTION:
Output:
EXPLANATION:
In this task, a MATLAB function is written to introduce a delay in a given sequence. The
sequence and its indices are defined, and the function shifts the signal by a specified amount. The
output shows two graphs: the first represents the original sequence, while the second displays the
delayed version. This demonstrates how shifting affects discrete-time signals in signal
processing.
In Lab Task 3:
Write a Matlab function ‘sigfold” for folding a given sequence ‘x[n]’ defined by arrays ‘x’
and “n’by using the pseudo code given in In-Lab Work section.
FUNCTION:
MATLAB CODE:
Output:
EXPLANATION:
In this task, a MATLAB function is written to fold a given sequence. The sequence and its
indices are defined, and the function flips the signal to achieve folding. The original and folded
signals are then plotted using MATLAB. The output shows two graphs: the first represents the
original sequence, while the second displays the folded version. This demonstrates how folding
affects discrete-time signals in signal processing.
In Lab Task 4:
Write a Matlab function ‘sigadd’ for adding two sequences x1[n] and x2[n] by using the
pseudo code given in In-Lab Work section.
MATLAB CODE:
FUNCTION:
Output:
EXPLANATION:
In this task, a MATLAB function is written to add two discrete sequences. The sequences and
their indices are defined, and the function aligns them before performing element-wise addition.
The original sequences and their sum are then plotted using MATLAB. The output shows three
graphs: the first two represent the individual sequences, while the third displays their sum. This
demonstrates how sequence addition works in discrete-time signal processing.
In Lab Task 5:
Let:
A. FUNCTION:
MATLAB CODE:
Output:
EXPLANATION:
In this task, a MATLAB function is written to compute a new sequence by shifting and scaling
the original sequence. The function first shifts the sequence by -5 and -4, and then applies the
scaling factors 2 and -3, respectively. The original and computed sequences are plotted using
MATLAB. The output consists of two graphs: the first shows the original sequence, while the
second displays the computed signal after shifting and scaling. This demonstrates how time
shifting and scaling affect discrete-time signals.
B. MATLAB CODE:
FUNCTION:
Output:
EXPLANATION:
In this task, a MATLAB function is written to compute a new sequence by shifting and adding
the original sequence. The function shifts the sequence by -3 and -2, and then adds the two
shifted sequences. The original and computed sequences are plotted using MATLAB. The output
consists of two graphs: the first represents the original sequence, while the second displays the
computed signal after shifting and addition. This demonstrates how time shifting and addition
modify discrete-time signals.
CRITICAL ANALYSIS:
In this lab, various discrete-time signal processing operations were implemented using
MATLAB. Tasks included signal shifting, scaling, folding, and addition, demonstrating their
effects on sequences. Each function modified the original signal by applying transformations
such as time delay, amplitude scaling, reflection, and summation. The graphical outputs provided
a clear visualization of these changes, reinforcing key concepts in discrete-time signal
processing. This lab helped in understanding how fundamental operations impact signals and
their applications in real-world scenarios.