Lab 1 SS
Lab 1 SS
Abstract
Objectives
The objectives of this lab were to understand and implement the generation
of basic signals in MATLAB, specifically:
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:
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.
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.
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.
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.
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:
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).
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.
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
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].