Author: Juan Rodriguez Esteban
This repository contains a MATLAB script that generates and plots six fundamental discrete-time signals: unit impulse, unit step, unit ramp, exponential, signum, and a discrete-time sinc. Each figure uses «stem()» (not «plot()»), has labeled axes and titles, and the code includes concise inline comments explaining the key steps. The structure and presentation follow the same style as the provided README.
Signal | Brief description | Typical expression |
---|---|---|
Unit impulse | Single sample at n=0 with unit amplitude | δ[n] |
Unit step | Switches from 0 to 1 at n=0 (with u[0]=1) | u[n] |
Unit ramp | Grows linearly from n=0 onward | r[n] = n·u[n] |
Exponential | Geometric sequence activated at n=0 | x[n] = A·αⁿ·u[n] |
Signum | Sign indicator over integers | sgn[n] ∈ {−1,0,1} |
Discrete-time sinc | Band-limited kernel on integers | y[n] = sin(ω_c n)/(π n), y[0]=ω_c/π |
Note: The normalized continuous-time «sinc(t)=sin(πt)/(πt)» sampled at integer «t=n» collapses to zero for all «n≠0». To visualize a non-trivial sequence on the integer grid, this script uses a parameterized cutoff «ω_c» (0<ω_c≤π), i.e., «y[n]=sin(ω_c n)/(π n)» with the limiting value «y[0]=ω_c/π».
Below are suggested paths to save or link the generated plots (replace with your actual export locations if you save figures to disk).
Signal | Figure path (placeholder) |
---|---|
Unit impulse | ![]() |
Unit step | ![]() |
Unit ramp | ![]() |
Exponential | ![]() |
Signum | ![]() |
Discrete-time sinc | ![]() |
-
Open MATLAB and set the working folder to this project directory.
-
Create a new script named «discrete_signals.m» and paste the provided code, or open your existing script file if you already saved it.
-
The script is divided into sections with «%%» (Unit Impulse, Unit Step, etc.).
-
Run one section at a time:
- Editor → Run Section, or Ctrl+Enter (Windows/Linux), Command+Enter (macOS).
- To run the current section and advance to the next: Ctrl+Shift+Enter (Windows/Linux), Command+Shift+Enter (macOS).
-
Execute sections in order (impulse, step, ramp, exponential, signum, sinc). Each section opens its corresponding figure using «stem()».
-
«u[0]=1» and «δ[0]=1» are implemented via logical expressions and «double(…)».
-
The ramp «r[n]=n·u[n]» is zero for «n<0» and equals «n» for «n≥0».
-
For the exponential example, pick «0<α<1» for a decaying sequence, «α>1» for growth, or «α<0» for sign-alternating behavior.
-
You can tweak:
- index range: «n_min», «n_max»
- exponential parameters: «A», «α»
- sinc cutoff: «ω_c» (0<ω_c≤π)
- If you see flat lines for the normalized sinc at integer «n», ensure you are using the parameterized version with «ω_c» as in the script notes.
- Use «grid on» and adjust «xlim/ylim» if stems are crowded or clipped.
This README’s layout and tone were modeled after the reference README in your repo (summary, tables, placeholders, and step-by-step run instructions).