0% found this document useful (0 votes)
2 views

Lab 1 SS

This report details an experiment conducted using MATLAB to generate and analyze basic signals, including unit step, unit impulse, sinusoidal, and exponential signals. The objectives were met by successfully implementing signal definitions and verifying their theoretical relationships, with results showing expected behaviors in both discrete and continuous time domains. The use of MATLAB allowed for effective visualization and confirmation of signal properties, demonstrating a solid understanding of fundamental signal behavior.

Uploaded by

ibrahimhama501
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views

Lab 1 SS

This report details an experiment conducted using MATLAB to generate and analyze basic signals, including unit step, unit impulse, sinusoidal, and exponential signals. The objectives were met by successfully implementing signal definitions and verifying their theoretical relationships, with results showing expected behaviors in both discrete and continuous time domains. The use of MATLAB allowed for effective visualization and confirmation of signal properties, demonstrating a solid understanding of fundamental signal behavior.

Uploaded by

ibrahimhama501
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 25

Lab 1: Generating and Analyzing Basic Signals with MATLAB

College of Engineering, The American University of Kurdistan


Electronics & Telecommunications Engineering Department

Course Code: EENG2304 – Signal and System


Student Name: Ibrahim Hama Ahmed
Student ID: A12100542
Instructor: Prof. Khalil
Date of Experiment: 4/13/2025
Date of Submission: 4/16/2025

Abstract

This report presents the generation and analysis of fundamental signals in


both discrete and continuous time domains using MATLAB. Basic signals
were created and visualized, including unit step functions, unit impulse
functions, sinusoidal signals, and exponential signals (growing and
decaying). The experiment's objectives – to implement these signal
definitions and verify their theoretical relationships – were successfully
achieved. Key results confirm that the discrete unit step and unit impulse
satisfy expected relationships (e.g. the unit step can be obtained by
summing impulses, and the unit impulse by differencing steps). Additionally,
continuous exponential signals with positive exponents exhibited growth,
while those with negative exponents decayed, consistent with theory. The
MATLAB simulation approach provided clear plots for each signal, and the
outcomes aligned with analytical predictions, demonstrating a solid
understanding of basic signal behavior.

Objectives

The objectives of this lab were to understand and implement the generation
of basic signals in MATLAB, specifically:

 Generate and plot discrete-time and continuous-time unit step


signals.
 Generate and plot a discrete-time unit impulse signal.
 Construct a unit step signal from unit impulses (by cumulative
sum) and verify the relationship.
 Construct a unit impulse signal from unit steps (by subtraction)
and verify the relationship.
 Generate a discrete signal from a continuous-time sinusoidal signal
(e.g. sampling a sine wave).
 Generate and plot growing and decaying exponential signals,
including a decaying exponential e^(−bt) for a specified constant b.
Introduction / Theoretical Background

Basic benchmark signals such as step, impulse, sinusoidal, and exponential


functions are fundamental in signal processing and system analysis [3].
These signals serve as building blocks: for example, any arbitrary discrete-
time signal can be constructed via a superposition of time-shifted unit
impulses (a property that underlies the convolution sum and impulse
response concept). This section briefly reviews the definitions and theoretical
properties of the signals examined in this experiment.

Unit Step Signal (Heaviside Function): The unit step is a binary-valued


function defined to be zero before a specific time and one afterward. In
continuous time, the unit step u(t)(Heaviside step function) is defined as
u(t)=0 for t<0 and u(t)=1 for t≥0. The discrete-time unit step u[n] is
similarly defined as 0 for n<0 and 1 for n≥0. This creates a discontinuity (a
jump from 0 to 1) at the origin. The unit step is widely used to represent
signals that "turn on" at a given time. It is also used as a test input for
systems to examine stability and causality.

Unit Impulse Signal (Delta Function): The unit impulse δ(t)\delta(t)δ(t) in


continuous time is an idealized signal that is zero for all time except an
infinitely high spike at t=0t=0t=0 with the unit area. In discrete time, the
unit impulse (also called unit sample) δ[n] is defined as δ[n]=1 at n=0, and
δ[n]=0 for all n≠0. It is a sequence with a single nonzero sample at the
origin. The unit impulse is of central importance because it acts as an
identity element for convolution and can sample other signals (i.e.,
x[n]δ[n−n0]=x[n0]δ[n−n0], which “picks out” the value of x at a specific
time).

Relationship between Unit Step and Unit Impulse: The unit step and
impulse are closely related in discrete and continuous times. In discrete
time, the unit impulse can be seen as the first difference of the unit step:

δ[n]=u[n]−u[n−1], and conversely, the unit step is the running summation


(cumulative sum) of unit impulses:

as given by the theoretical identities [2]. These relationships imply that


summing a sequence of discrete impulses up to time n produces a step (0 for
n<0 and 1 for n≥0) and differencing a step sequence yields an impulse at
the point of the step discontinuity. In continuous time, an analogous
relationship holds regarding differentiation and integration: the continuous-
time impulse is the derivative of the step, and the step is the integral of the
impulse. In practice, the continuous-time unit impulse is a mathematical
abstraction; in simulations we approximate it by a very narrow pulse or by
discrete-time sampling.
Sinusoidal Signal: A sinusoidal signal is a fundamental periodic waveform
characterized by its amplitude, frequency, and phase. The general form of a
sinusoid is:

where A is amplitude, f is frequency in Hz (cycles per second), and ϕ is


phase. Equivalently, x(t)=Asin(Ωt+ϕ) using angular frequency Ω=2πf. For
example, x(t)=sin(0.5πt) is a sinusoid of angular frequency 0.5π rad/s,
corresponding to a frequency f=0.25 Hz and a period T=2π/0.5π=4 units of
time (since one full cycle occurs when 0.5πt=2π0.5\pi t = 2\pi0.5πt=2π)[3].
Sinusoidal signals oscillate smoothly and are widely used to test system
frequency response due to their ubiquity in physical phenomena and ease of
analysis via Fourier methods.

Exponential Signals: Exponential functions are another fundamental signal


type, expressed as x(t)=Ae^(at) for continuous-time or x[n]=Aα^n for
discrete-time (where α=e^a if we sample the continuous form). The

exponential grows or decays. If a>0 (or ∣α∣>1), the signal grows without
exponent a's sign (or magnitude of α\alphaα) determines whether the

bound as time increases; if a<0(or ∣α∣<1), the signal decays toward zero for
ample time [3]. When a=0 (or α=1), the exponential becomes a constant
signal x(t)=A. For example, x(t)=e^ (0.5t) represents a rising exponential,
while y(t)=e^(−0.42t) is a decaying exponential that falls off over time.
Exponential signals often model natural processes (e.g., charging of a
capacitor, population growth/decay) and characterize system impulse
responses (e.g., the homogeneous solutions of linear constant-coefficient
differential equations yield exponentials). In discrete time, exponentials take
the form e^ (an) or α^n; if α=e^a, then similar growth/decay behavior is
observed across the integer index n.

These basic signals (steps, impulses, sinusoids, exponentials) form a


foundational toolkit. The experiment will use MATLAB to generate these
signals, allowing visual confirmation of their behaviors and the verification of
the theoretical relationships outlined above. The use of MATLAB (an
interpreted numerical computing environment) provides convenient built-in
functions for array operations and plotting, which we will leverage to
simulate the signals over specified ranges.

Experimental Methods and Materials

Materials/Equipment: This lab was conducted using a computer running


MATLAB software (R2021b) for simulation. No physical hardware was
required since all signals were generated computationally.
Methods: The procedure involved writing and executing MATLAB scripts for
each type of signal described in the objectives. For each signal, we defined
an appropriate range for the independent variable (time index n for discrete
signals or continuous time t sampled at a fine resolution for analog signals).
Then, the signal values were computed according to their mathematical
definitions (using element-wise operations and logical conditions in MATLAB).
The signals were visualized using MATLAB’s plotting functions: stem() for
discrete-time sequences (which produces a stem plot of individual samples)
and plot() for continuous-time signals (plotting a continuous curve by
connecting sampled points). We followed the formulas from the theoretical
background to implement each case. All code was written in a script (M-file)
format for reproducibility. Comments were included to document each step.
A key consideration in generating the discrete-time signals was handling
negative indices (since MATLAB array indexing starts at 1). This was
addressed by creating an array n that explicitly spans the desired negative-
to-positive range and computing the signal as a function of this array rather
than relying on MATLAB’s implicit indexing. For example, to represent
n=−10n=-10n=−10 to 101010, we used n = -10:10; and then defined
signals as vectors of the same length as n. After generating each signal, we
applied appropriate plotting commands for clarity with axis labels and titles.
Where relevant, multiple subplots were used to compare related signals (e.g.
an impulse and the cumulative sum that yields a step). The results (plots)
were observed and analyzed against expected theoretical behavior. Since
this is a software simulation, no physical measurements or uncertainties are
involved; however, we ensured that the sampling resolution for continuous-
time signals (e.g. time step of 0.01) was fine enough to clearly illustrate
signal shapes (especially around discontinuities like the step function). In the
following section, we present the results, the MATLAB code used, and
discussions comparing the outcomes with theoretical expectations. All
results are reported with units normalized (since signals are unitless in this
context), and each figure is labeled correctly.

Results, Analysis and Discussion

Discrete and Continuous Unit Step Signals

To generate a discrete-time unit step sequence u[n], we defined a vector


of indices n from -10 to 10 and initialized an array of zeros. Then, we set all
elements with n≥0 to 1. The MATLAB code below was used:
Executing this code produces the plot of the sequence.

Figure 1: Discrete-time unit step sequence u[n].

As shown, the signal is zero for negative indices (n<0) and equal to one for
n≥0. This matches the definition of the unit step function [1]. The step
occurs at n=0, where the sequence “steps” from 0 to 1. The figure uses a
stem plot to emphasize that this is a discrete sequence (the yellow circles
indicate sample values at integer n, with lines dropping to a baseline of 0).
The plot confirms that u[n] remains at 0 for n=−10,−9,...,−1 and then takes
the value 1 for n=0,1,2,...,10. In practice, the step is often used to model
signals that turn on at a certain index. We observe that at exactly n=0,
u[0]=1 in this discrete implementation (by convention u[0]=1). This discrete
result is as expected and adheres to the theoretical definition of the unit step
sequence.

For the continuous-time unit step u(t), we cannot directly realize an ideal
discontinuity in MATLAB, but we can approximate it by sampling u(t) over a
dense time grid and plotting. We used a time vector t from -1 to 1 with an
increment of 0.01 and defined u_t similarly by a logical condition (t >= 0).
The code segment was:
Figure 2: Continuous-time unit step function u(t) (approximated).

The plotted curve shows that u(t) is 0 for all t<0 and 1 for t>0. At t=0 there
is a jump discontinuity from 0 to 1. In the rendered graph, this jump is
depicted by a nearly vertical line at t=0. This aligns with the theoretical
Heaviside step function [3]. We note that the concept of u(0) (the value
exactly at the discontinuity) is sometimes defined as 0.5 for theoretical
symmetry, but in engineering practice it’s usually taken as 1 for the unit
step. Our implementation set u(0)=1 (since the condition t >= 0 includes
equality). The approximation with a fine time grid produces a very steep
transition at 0, effectively visualizing the ideal step. The continuous step is
an important test signal for systems; for example, in a causal LTI system, the
response to u(t) defines the step response. Here, the result demonstrates the
expected behavior: no output before t=0, and a constant output after t=0.
The pair of results (Figures 1 and 2) highlight the similarity between discrete
and continuous steps, with the discrete case changing only at integer steps
and the continuous being defined for every time instant.

Unit Impulse Signal (Discrete-Time)

The unit impulse in continuous time is a theoretical construct, but in discrete


time it is straightforward to implement. Using MATLAB, we generated a
discrete unit impulse δ[n] that spans n=−10 to n=10 with a value of 1 at
n=0 and 0 elsewhere. One convenient method is to create an array of zeros
and then set the center element (corresponding to n=0) to 1. Alternatively,
one can concatenate zeros and a one. We used the approach given in the lab
sheet:
Figure 3: Discrete-time unit impulse sequence δ[n].

As expected, the plot shows a single nonzero sample at n=0, reaching a


value of 1, while all other time indices have a value of 0. The stem plot
emphasizes that δ[0]=1 and δ[n]=0 for n≠0 [1]. We set the y-axis limit to
1.5 in the code to leave some visual headroom above the impulse. The result
confirms the defining property of the unit impulse. This sequence is
sometimes called the Kronecker delta in discrete contexts. It is the identity
element for convolution (convolving any sequence with δ[n] leaves it
unchanged). The successful generation of δ[n] provides a basis for verifying
theoretical relationships with the unit step. Notably, if we compare Figure 3
with Figure 1, we can qualitatively see that the impulse is concentrated at
the point where the step jumps. In the next sections, we use this impulse to
reconstruct the step and vice versa, as a way to validate the relationships
δ[n]=u[n]−u[n−1] and

Generating a Unit Step from Unit Impulses (Cumulative Sum)

One fundamental property is that a unit step can be obtained by summing up


unit impulse contributions over time [1]. In discrete terms, .
The cumulative sum of the discrete impulse sequence was performed to
demonstrate this. Starting with the δ[n] from the previous part, we used
MATLAB’s cumsum() function to accumulate the values. The following code
was executed:
Figure 4: Demonstration of summation relationship – (a) unit impulse δ[n];
(b) cumulative sum producing unit step u[n].

In subplot (a), we see the impulse sequence (only δ[0]=1); in subplot (b), we
see the resulting sequence after cumulative summation. The cumulative sum
effectively integrates the impulse: for n<0, no impulses have occurred yet,
so the sum is 0; for n≥0, the impulse at 0 contributes, and from that point
onward, the sum stays at 1. Thus, the sequence in (b) is exactly the unit
step: 0 for n<0, and 1 for n≥0. This experimentally verifies the formula
. The result in Figure 4(b) perfectly matches Figure 1 (the
directly generated step). This confirms that integrating (summing) an
impulse train yields a step, analogous to how the mathematical running
integral of an ideal impulse yields a step in continuous time [2]. The small
simulation validates the theoretical relationship using our discrete data. It’s
also a nice illustration of how accumulating a "burst" at the origin produces a
permanent step change in the signal. From a systems perspective, this
operation is related to the concept of the step response: the step can be
viewed as the integral of an impulse (since an LTI system’s step response is
the integral of its impulse response). In our discrete example, we directly
constructed the step from the impulse without involving a system, but the
mathematical analogy holds.

Generating a Unit Impulse from Unit Steps (First Difference)

Conversely, a unit impulse can be obtained by taking the first difference of a


unit step sequence. The theoretical identity δ[n]=u[n]−u[n−1] means if we
subtract a unit step shifted by one sample from the original step, the only
non-zero result should be at the point of the discontinuity (the “jump” at
n=0) [1]. We tested this relationship in MATLAB. We first generated a unit
step u_n as before, and also a shifted version u[n−1] by evaluating the step
condition on n-1. Then, we subtracted the two sequences. The code was:
Figure 5: Discrete unit impulse obtained by δ[n]=u[n]−u[n−1].

The resulting plot shows a single impulse at n=0 with value 1, and zeros
elsewhere – exactly the unit impulse sequence. This verifies that subtracting
a unit step delayed by one sample yields an impulse at the origin. To
understand the result: for all n<0, both u[n] and u[n−1] are 0, so the
difference is 0; at n=0, u[0]=1 but u[−1]=0, so the difference is 1; for n≥1,
both u[n] and u[n−1] equal 1, so their difference is 0. Thus, the difference
sequence is zero everywhere except at n=0n=0n=0, where it is 1, matching
δ[n]\delta[n]δ[n] by definition [1]. Comparing Figure 5 to Figure 3 (the
directly generated impulse), we see they are identical. This confirms the
theoretical first-difference property in our simulation.

It is worth noting that this difference operation is a discrete analog of


differentiation. In continuous time, the derivative of a step is an impulse (in
the distribution sense) [2]. Here, we effectively computed a discrete
derivative. The success of this method further reinforces our confidence in
correctly implementing the unit step and impulse. It also demonstrates how
differences can pick out abrupt signal changes – a concept used in edge
detection in signal processing.

Exponential Signals (Growing and Decaying)

We next explored exponential signals in both continuous and discrete


domains. Two cases were examined: a growing exponential (with a positive
exponent) and a decaying exponential (with a negative exponent). The
experiment also specified using a particular decay rate based on student ID;
here, we use b=0.42 as an example (interpreted as the last two digits 42
divided by 100).

We chose the form x(t)=e^ (0.5t) with growth rate a=0.5 for the continuous-
time growing exponential. The time range was set from −1 to 5 (so that we
can see the behavior for a negative time as well). The MATLAB code:

Figure 6: Continuous growing exponential x(t)=e^(0.5t).


The plot shows an exponential curve that increases as ttt increases. At t=0,
x(0)=e^0=1. For t<0, x(t) produces values less than 1 (since e^ (0.5t)<1 for
negative t), approaching 0.61 at t=−1. As time moves into positive territory,
the signal grows exponentially: by t=2, x(2)=e^1=2.718; by t=5,
x(5)=e^2.5≈12.18, which is off the top of the plotted range (the figure
shows up to around 12 on the vertical axis). This behavior is consistent with
a positive exponent a=0.5. The signal doubles in value roughly every
t≈1.386t (since e^(0.5⋅1.386)≈2). The concave-up shape and accelerating
increase indicate exponential growth. This matches the expectation that if
a>0, e^(at) is a growing exponential [3]. The negative time portion
illustrates that x(t) decays towards 0 as we go to more negative times
(though it never becomes zero for finite negative times, approaches zero as
t→−∞).

For the discrete-time growing exponential, we considered x[n]=e^


(1⋅n)=e^ n, which has a base e≈2.718. We computed this for n=−10 to
n=10. The MATLAB code and stem plot are as follows:
Figure 7: Discrete growing exponential x[n]=e^ n.

The stem plot highlights the discrete nature of this signal. At n=0, x[0]=1 (as
any e^ (a⋅0)=1). For negative indices, x[n]=e^ n yields fractional values
between 0 and 1 (e.g. e^b−1≈0.367,e^ −2≈0.135, which appear as very
small stems near the baseline). For positive n, the values grow very rapidly:
x[1]=2.718, x[2]=7.389, x[3]=20.085, and by n=10, x[10]=e^10≈22026.5.
The plot is dominated by the large values at the rightmost end; the vertical
scale extends above 20,000 to accommodate n=10. Consequently, the
values for n<5 are almost indistinguishable from 0 on this scale. This
demonstrates the extremely fast growth of a discrete exponential with base
e. It also underscores a difference between continuous and discrete
exponentials: a continuous e^ (0.5t) grows moderately (because the
exponent 0.5 is relatively small), whereas a discrete e^n effectively has base
e>1 and thus explodes in value as n increases. Both Figures 6 and 7 reflect
the general principle that a positive exponent leads to exponential growth
[3]. The discrete case with a=1 (base e) grows faster than the continuous
case with a=0.5 because effectively each increment of 1 in n multiplies the
value by e. If we desired a more modest discrete growth, we could use a
smaller base (for instance, x[n]=(1.1)^n would grow more slowly).

For the continuous-time decaying exponential, we followed the lab


instruction to use e (−bt) with b=0.42. We generated y(t)=e^ (−0.42t) for t
from 0 to 10 (starting at 0 to focus on the decay after the initial value). The
code:
Figure 8: Continuous decaying exponential y(t)=e^ (−0.42t).

The plot starts at y(0)=e^0=1 and decays towards zero as t increases. The
curve is exponentially decreasing, falling to around y(2.5)=e^−1≈0.37 by
t≈2.38 (which is the time constant 1/b), and further down to y(5)=e−^
2.1≈0.12. By t=10, y(10)=e−4.2≈0.015, which is very close to zero (the
graph approaches the horizontal axis). This confirms the expected behavior
for a negative exponent (here −0.42-0.42−0.42): the signal exhibits
exponential decay [3]. The decay rate is governed by b; a larger b would
decay faster. In this case, the value drops to nearly negligible levels by the
end of the plotted interval. No oscillation or overshoot occurs; the decay is
smooth and monotonic. This kind of signal models processes like radioactive
decay or charging capacitor voltage declining over time. Comparing Figure 8
with Figure 6, we see the opposite trend: one rises, one falls, as determined
by the sign of the exponent. Both, however, have the property x(0)=1 and an
exponential rate of change.

It is evident from Figures 6–8 that our MATLAB-generated exponentials align


well with theory. Specifically, for which is positive,
indicating growth, whereas for is negative, indicating a
decay. The discrete exponential (Figure 7) highlights that for n>0, each
step multiplies the value by a constant factor (e^1 in our case), hence the
rapid escalation in magnitude. Overall, the experiment confirms that MATLAB
can accurately render both increasing and decreasing exponential signals,
and the results visually reinforce the mathematical descriptions of these
signals.

Sinusoidal Signal (Continuous and Sampled)

The final part of the experiment involved generating a sinusoidal signal


and examining its discrete sampling. We chose the signal x(t)=sin(0.5πt), as
specified in the lab sheet. The angular frequency here is 0.5π rad/s, so the
signal completes a half cycle every 2 time units (full period of 4 units, since
0.5π×4=2π). We generated this signal over a time interval sufficient to see
multiple oscillations. The MATLAB code used was:
Figure 9: Continuous sinusoidal signal x(t)=sin(0.5πt).

The plotted sinusoid starts at 0 at t=0 (since sin(0)=0), rises to 1 at t=1


(because sin(0.5π⋅1)) =sin(π/2)=1), goes back to 0 at t=2 sin(π)=0), down to
-1 at t=3 (sin(1.5π)=−1), and returns to 0 at t=4 (sin(2π)=0), completing
one full cycle in 4 time units. The pattern then repeats for 4 < t ≤ 8, showing
a second cycle (peaking at t=5, zero at t=6, trough at t=7, zero at t=8). This
confirms the expected period T=4 for this sinusoid. The waveform oscillates
smoothly between -1 and +1. The grid lines in Figure 9 help identify these
key points (maxima at 1, minima at -1, zeros at the multiples of 2). This
behavior is exactly as predicted by the sinusoidal function's properties [3].
The amplitude is 1, and there is no phase shift (since x(0)=0, indicating a
sine phase of 0).

An interesting extension is to consider the discrete samples of this


continuous sinusoid at integer time points. If we take n as an integer and
evaluate x[n]=sin(0.5πn), we effectively sample the continuous signal once
every 1 time unit. Given the period of 4, sampling at t=n picks 4 points per
period. In fact, sin(0.5πn) for integer n yields a repeating sequence:
sin(0.5π⋅0)=0, sin(0.5π⋅1)=1, sin(0.5π⋅2)=0, sin(0.5π⋅3)=−1, sin(0.5π⋅4)=0,
and then it repeats every 4 samples. Thus the discrete-time sequence would
be 0, 1, 0, −1, 0, 1, 0, −1, ...We can illustrate this by plotting the sampled
points on the same graph or separately as a stem plot. If overlaid on Figure
9, these samples would correspond to the intersections of the curve with
vertical grid lines at integer t: indeed hitting 0, ±1 in the described pattern.
This discrete sequence can be considered a signal derived from a
continuous sinusoid by sampling. It demonstrates that sampling a
continuous sinusoid at an interval equal to a quarter of its period yields a 4-
point periodic sequence. In the context of the lab objectives, this addresses
“generating a discrete signal from a continuous-time sinusoidal signal.”
While we did not explicitly plot the stem points in the figure, the values
mentioned follow directly from the continuous plot and were verified in
MATLAB by observation. The crucial point is that our continuous sine wave
generation is correct (as evidenced by the smooth oscillation and correct
period), and if needed, one can obtain the discrete-time counterpart by
sampling it at desired intervals.

The sinusoidal signal is fundamental in signal processing since any arbitrary


signal can be decomposed into sinusoids via Fourier analysis. In this
experiment, plotting the sine wave confirmed our understanding of
frequency and period. The MATLAB result aligns perfectly with the expected
sinusoidal behavior and provides a visual confirmation of the signal’s
properties (amplitude 1, period 4, zero crossings and peaks at the correct
locations).

Time-Reversed and Shifted Unit Step u[−n−3]

Finally, we generated and analyzed the signal u[−n−3], which is a time-


reversed and shifted version of the unit step. This signal is effectively a step
that is flipped in time and moved. Specifically, u[−n−3] can be interpreted
as u(−(n+3)). We can determine its behavior analytically: The unit step u[k]
is 1 for k≥0 and 0 for k<0. If we set k=−n−3, then u[−n−3]=1 −n−3≥0 (and
0 otherwise). To confirm this, we implemented the sequence in MATLAB for
n=−10 to 10:
Figure 10: Discrete-time signal u[−n−3].

The stem plot shows that from n=−10 up to n=−3, the signal has value 1
(the flat line of stems at 1 on the left side), and for n=−2,−1,0,... up to 10,
the signal is 0 (stems on the baseline). Notably, at n=−3, the signal
transitions from 1 (for n≤−3) to 0 for just above −3. This is exactly in line
with the analytic prediction: u[−n−3] yields a step that "turns off" at n=−3.
In other words, it is the time-reversed version of a step that would normally
turn on at +3. If we compare this to the standard unit step u[n] (Figure 1),
we see a mirror image about n=−1.5 (midpoint between -3 and -0?), but
more concretely, u[−n−3] can also be seen as u[−(n+3)]=u[−m] with
m=n+3. Setting m=n+3 means a shift of 3 to the left, and the negative sign
means time reversal. Thus, u[−n−3] is a step that is 1 to the left of a certain
point and zero to the right, instead of the usual step which is zero to the left
and one to the right. Our plot confirms this: for all indices to the left of -3, the
signal is in the "1" state, and after -3 it switches to "0". The transition point
(the discontinuity) is at n=−3, where the function value goes from 1 (n=−3
and below) down to 0 (for −2 and above).

This result helps illustrate time-reversal properties. If one were to shift the
original unit step u[n] to the left by 3 (i.e. u[n+3]), one would get a step that
turns on at n=−3n=-3n=−3 (being 1 for n≥−3). Now time-reversing that
(considering n→−n) yields u[−n−3]. Indeed, u[−n−3] is essentially the step
reflected about the vertical axis n=−1.5 and thus has the opposite
orientation. This exercise, although a bit tangential, confirms that our
understanding of indexing and condition implementation in MATLAB is solid.
The plot of u[−n−3] meets the expectation and provides one more data
point in verifying that the step function behavior under transformations is
correctly simulated.
Discussion

Across all the above results, the MATLAB-generated plots matched


theoretical expectations for each signal type. We included MATLAB code in
each case to show how the signals were constructed, and the accompanying
figures to show the outcomes. No significant challenges were encountered
during the implementation – once the logic for handling indices (especially
negative indices for discrete signals) was set up correctly, MATLAB’s
vectorized operations made it straightforward to assign values based on
conditions. One thing to note is that MATLAB treats logical conditions on
arrays as element-wise operations, which we leveraged (e.g., n >= 0
produces a boolean array that we used to index or assign values). This is an
efficient way to generate piecewise-defined signals like the step and
impulse. Another point of discussion is the trade-off in resolution for
continuous-time approximations. For the continuous plots (unit step,
sinusoids, exponentials), we chose a time increment (0.01) fine enough to
produce smooth curves and sharp transitions. A coarser step might make the
plots look jagged or misrepresent abrupt changes. For example, had we
chosen t = -1:0.1:1 for the continuous step, the vertical jump at 0 would
appear less steep, and the plotted step might look more like a quick ramp.
Thus, using a sufficiently small time step is important to capture the nature
of continuous signals faithfully. Finally, we reflect on how these basic signals
relate to theoretical concepts covered in class. The experiment reinforced
the idea that the unit impulse is in some sense the “derivative” of the unit
step in discrete time (difference operation) and that the unit step is the
“integral” (sum) of impulses [1]. Seeing this in a concrete numerical example
helps solidify that understanding. Additionally, observing the sinusoid and
exponential behaviors in the time domain sets a foundation for later studies
(such as how sinusoids relate to frequency response and how exponentials
relate to stability of systems). There were no significant errors in the
simulation results; all outcomes were as predicted. This suggests that the
methods used were appropriate and that MATLAB is a reliable tool for
visualizing such fundamental signals. If this lab were to be extended or
improved, one could investigate the effect of sampling frequency on the
representation of continuous signals (for instance, sampling the sine wave at
different rates to see aliasing or loss of information). Another extension is to
explore two-sided exponentials (including negative time for decaying
exponentials to see growth in negative time direction, which we partially did
for the continuous growing exponential). However, within the scope of the
given objectives, the lab results are complete and demonstrate each concept
clearly.

Conclusion
In this lab, we successfully generated and analyzed several basic signals
using MATLAB, following the guidelines and objectives outlined. We created
discrete-time and continuous-time unit step functions, confirming their
values (0 for negative time and 1 for non-negative time) and visualizing the
discontinuity at the origin. We generated the discrete unit impulse and
verified its property of being zero everywhere except at the origin. Crucially,
we demonstrated that the discrete unit step and unit impulse are related by
summation and differencing: the cumulative sum of an impulse sequence
produces the step, and the first difference of a step yields an impulse, in
agreement with the theoretical relationships . We also generated exponential
signals, observing that a positive exponent causes exponential growth while
a negative exponent causes exponential decay, matching the expected
behavior of e^ (at) and e^ (−bt) functions. The sinusoidal signal sin(0.5πt)
was plotted to verify its periodic nature and frequency content, and the
concept of deriving a discrete sequence via sampling was discussed.
Additionally, we explored a time-reversed shifted step u[−n−3] to further
solidify our understanding of signal transformations. All objectives of the lab
were met. The MATLAB simulations produced plots that align perfectly with
analytical predictions, thereby validating both the computational approach
and the underlying signal theory. The results confirm that we have a strong
grasp of how these fundamental signals behave and how to implement them
in a computational tool. Moreover, this lab experience lays a groundwork for
future experiments, as these basic signals are often used as test inputs or
building blocks in more complex signal processing and systems analysis
tasks. The systematic approach – defining the signal mathematically,
implementing in MATLAB, and interpreting the output – proved effective and
will be valuable in subsequent labs. In conclusion, the lab deepened our
practical understanding of unit step and impulse functions, sinusoids, and
exponentials, and it demonstrated the powerful synergy between theoretical
concepts and computational verification.

References

[1] Fosco Connect, "The unit impulse and unit step functions," Fiber Optics
For Sale Co. – Wave Optics Tutorials, 2019. [Online]. Available:
https://www.fiberoptics4sale.com/blogs/wave-optics/the-unit-impulse-and-
unit-step-functions. [Accessed: Apr. 16, 2025].

[2] MIT OpenCourseWare, "Lecture 3: Signals and Systems (Part II) – Unit
Step and Unit Impulse," Massachusetts Institute of Technology, Spring 2011.
[Online]. Available: https://ocw.mit.edu/courses/res-6-007-signals-and-
systems-spring-2011/
a21157f121ca5ba3d946766a5d387018_MITRES_6_007S11_lec03.pdf.
[Accessed: Apr. 16, 2025].
[3] Tutorials Point, "How to generate unit step, sinusoidal and exponential
signal in MATLAB," tutorialspoint.com, 2021. [Online]. Available:
https://www.tutorialspoint.com/how-to-generate-unit-step-sinusoidal-and-
exponential-signal-in-matlab. [Accessed: Apr. 16, 2025].

You might also like