signal lab report 03
signal lab report 03
MATLAB
❖ Pre-lab Tasks:
• Unit Step Function:
The unit step function, denoted as u(n) in discrete-time or u(t) in
continuous-time, is a function that is zero for negative inputs and
one for zero and positive inputs. Mathematically, it is defined as
• Ramp Sequence:
A discrete-time function defined as
𝑟(𝑛) = 𝑛 for 𝑛 ≥ 0 and 𝑟(𝑛) = 0 for 𝑛 < 0 representing a linearly
increasing signal.
• Signum Sequence:
A function defined as
Page 1 of 10
• Square wave:
A periodic signal alternating between two levels, typically +1 and
-1, with a 50% duty cycle.
Page 2 of 10
❖ In-lab Tasks I:
Create a function “impseq”, which performs following operations:
Function [x,n]=impseq(n0,n1,n2)
Takes three parameters (n0, n1, n2) as input, where ‘n1’ and ‘n2’ are
lower and upper limits of n axis, and ‘n0’ is the delay.
Generates a unit-impulse sequence using above mentioned three
parameters.
There should be two output arguments [x, n] of function ‘impseq’,
where ‘x’ is impulse sequence and ‘n’ is its corresponding n-axis.
Finally, plot unit impulse ‘x’ against vector ‘n’.
On the main window, type “[x,n]=impseq(0,-5,5)”
• Readings:
Page 3 of 10
❖ In-lab Tasks II:
Make a function to form “stepseq” function which will output unit-step
sequence. Function [x,n]=stepseq(n0,n1,n2)
Unit Step Sequence, We can have another elegant way to produce a
step function, Alternatively, we can use the “ones” function
Type “stepseq[x,n]=(0,-5,5)” we get:
• Readings:
Page 4 of 10
❖ In-lab Tasks III:
Create a function “rampseq”, which performs following operations
Function [x,n]=rampseq(n0,n1,n2)
Takes three parameters (n0, n1, n2) as input, where ‘n1’ and ‘n2’ are
lower and upper limits of n axis, and ‘n0’ is the delay.
Generates a ramp sequence using above mentioned three parameters.
There should be two output arguments [x, n] of function ‘rampseq’,
where ‘x’ is impulse sequence and ‘n’ is its corresponding n-axis.
Finally, plot ramp impulse ‘x’ against vector ‘n’
• Readings:
Page 5 of 10
❖ In-lab Tasks IV:
Create a function “sigseq”, which performs following operations:
Function [x,n]=sigpseq(n0,n1,n2)
Takes three parameters (n0, n1, n2) as input, where ‘n1’ and ‘n2’ are
lower and upper limits of n axis, and ‘n0’ is the delay.
Generates a signum sequence using above mentioned three parameters.
There should be two output arguments [x, n] of function ‘sigseq’, where
‘x’ is impulse sequence and ‘n’ is its corresponding n-axis.
Finally, plot signum sequence ‘x’ against vector ‘n’.
• Readings:
Page 6 of 10
❖ In-lab Tasks V:
Find E∞ for the following signal tri(t )= {1−|t||t|<1
• Readings:
Page 7 of 10
❖ In-lab Tasks VI:
Find P∞ for the following signal x[n]=cos( π/4 *n)
• Readings:
Page 8 of 10
• Readings For Discrete:
Page 9 of 10
❖ Critical Analysis:
In this lab we learned about the basic signal generation in MATLAB.
We also learned about the various MATLAB-supported wave and
sequence types. We created periodic signals and also energy and power
of discrete time sequences and of continuous time signal in MATLAB.
We also carried out tasks to demonstrate that we also introduced
deterministic and stochastic signals, as well as odd signals. In addition
we performed the basic tasks using operators that we have leaned
before this lab.
Page 10 of 10