Created by Dr. V. R. Ratnaparkhe
Signals & SystemsVirtual Laboratory
Experiment 02 · Signals & Systems Lab

Generation of Elementary Signals

Generate unit step, impulse, ramp and sinusoidal sequences, then observe them on a virtual function generator and CRO.

Stem plotsFunction generatorCROCO 1-3

Aim

Write a program to generate discrete sequences: (i) unit step, (ii) unit impulse, (iii) ramp and (iv) periodic sinusoid, and plot them all. Use a function generator and CRO to observe these signals in continuous time, and vary and measure their amplitude and frequency. Generate the same signals with the Simulink toolbox.

Objectives

  • Define δ[n], u[n], r[n] and A·cos(ω₀n+φ) and generate each one with vector operations.
  • Find out when a discrete sinusoid is periodic, and work out its fundamental period N.
  • Use the CRO graticule (V/div, time/div) to measure peak-to-peak voltage, period and frequency.
  • Make the same signals with Simulink Source blocks and view them on a multi-channel Scope.

Apparatus

Real labVirtual equivalent
MATLAB + SimulinkSequence generator + Simulink block view
Function generator (0.1 Hz – 1 MHz)Virtual function generator with sine, square, triangle and ramp
Dual-trace CRO (20 MHz)Virtual CRO with V/div, time/div and trigger
BNC probes and leads(wired for you)

Elementary discrete-time signals

Unit impulse δ[n] = 1 for n = 0, 0 otherwise Unit step u[n] = 1 for n ≥ 0, 0 for n < 0 Unit ramp r[n] = n for n ≥ 0, 0 for n < 0 Sinusoid x[n] = A cos(ω₀n + φ), ω₀ = 2πf₀

These signals are related: δ[n] = u[n] − u[n−1], u[n] = Σ δ[k] for k ≤ n, and r[n] = n·u[n]. Any discrete signal can be written as a weighted sum of shifted impulses: x[n] = Σ x[k]·δ[n−k].

Periodicity of a discrete sinusoid

x[n] = cos(2πf₀n) is periodic only if f₀ = k/N is a rational number. The fundamental period is the smallest N for which f₀N is a whole number. For example, f₀ = 3/20 gives N = 20. But cos(0.5n) has ω₀ = 0.5, so f₀ = 0.5/2π is irrational and the sequence never repeats exactly.

Measuring with a CRO

Vpp = (vertical divisions, peak to peak) × (Volts/div) Period T = (horizontal divisions for one cycle) × (Time/div) Frequency = 1 / T Vrms(sine) = Vpp / (2√2)
The trigger starts every sweep at the same point on the waveform (the same level and slope), so the picture stands still. If the trigger level is outside the signal's range, the trace "rolls" across the screen.

A. MATLAB sequences

  1. Choose a signal type in Simulator → A.
  2. Set the range n = N₁…N₂ and the amplitude.
  3. Shift with n₀ and see the formula change.
  4. For the sinusoid, try f₀ = 0.05, 0.15 and 0.5/2π, and note whether each one is periodic.
  5. Switch on Show all four to see the signals side by side.

B. Function generator & CRO

  1. Choose sine and set 1 kHz and 4 Vpp.
  2. Adjust V/div and time/div until about 2 cycles fill the screen.
  3. Count the vertical divisions peak to peak and the horizontal divisions per cycle.
  4. Work out Vpp and f, and type them into the Observations table.
  5. Repeat for square, triangle and ramp waves at 3 different settings.
  6. Move the trigger level outside the signal and watch the trace roll.

C. Simulink

  1. Turn on the Step, Pulse (impulse), Ramp and Sine blocks.
  2. Set their parameters and press Run.
  3. Compare the 4-channel scope with the MATLAB plots.
Safety (real lab): keep the function generator output below 10 V, connect the probe ground to circuit ground first, and never block the instrument's ventilation slots.

Pre-lab diagnostic

A. Discrete sequence generator

Parameters

AudioA discrete sinusoid at f₀ cycles/sample sounds at f₀ × 8000 Hz. Try f₀ = 0.1 and then f₀ = 0.9: they sound identical.

B. Function generator → CRO

Function generator

Audio

The speaker follows the waveform, frequency and amplitude live. Square and ramp sound "buzzier" because they contain more harmonics.

CRO controls

Set Vpp—
Set f—
Div p–p?
Div / cycle?

C. Simulink — 4-channel scope

Source blocks

Table 1 — Amplitude measurement on the CRO

Record a setting, read the graticule, then type your measured Vpp.

Table 2 — Frequency measurement on the CRO

Table 3 — Periodicity of discrete sinusoids

Analysis

Post-lab quiz

Self-evaluation

exp2_signals.m

%% Experiment 2: Elementary discrete-time signals
clc; clear; close all;
n = -10:10;
imp  = (n==0);                 % unit impulse
stp  = (n>=0);                 % unit step
rmp  = n.*(n>=0);              % unit ramp
A = 2; f0 = 0.1; phi = 0;
sn   = A*cos(2*pi*f0*n + phi); % sinusoid, N = 1/f0 = 10
subplot(2,2,1); stem(n,imp,'filled'); title('\delta[n]');
subplot(2,2,2); stem(n,stp,'filled'); title('u[n]');
subplot(2,2,3); stem(n,rmp,'filled'); title('r[n]');
subplot(2,2,4); stem(n,sn ,'filled'); title('A cos(2\pi f_0 n)');
for k=1:4, subplot(2,2,k); xlabel('n'); grid on; end
%% Simulink: Step, Pulse Generator (width=1 sample), Ramp, Sine Wave -> Mux -> Scope