SS Notes
Getting started with GNU Octave for signal processing — basic operations, plotting signals, implementing filters, and spectral analysis.
Introduction
GNU Octave is a free, open-source numerical computing environment that is largely compatible with MATLAB. For students who cannot access MATLAB, Octave provides nearly identical functionality for signal processing coursework — the same syntax, the same functions, and the same plotting capabilities. If you learn Octave, you effectively learn MATLAB simultaneously, making this a highly practical investment.
Octave runs on Windows, macOS, and Linux, and includes a signal processing package that provides most of the functions needed for undergraduate signals and systems courses. This guide covers the essential operations you will need: generating signals, plotting in time and frequency domains, implementing convolution and filtering, and performing spectral analysis.
Installation and Setup
Install Octave from the official website (gnu.org/software/octave). After installation, add the signal processing package:
Load this package at the start of every session to access signal processing functions.
Generating Basic Signals
Time Vector
fs = 1000; % Sampling rate (Hz)
t = 0:1/fs:1-1/fs; % Time vector: 0 to 1 second
N = length(t); % Number of samplesCommon Signals
% Sinusoid
x_sin = sin(2*pi*50*t); % 50 Hz sine wave
% Unit step
x_step = ones(1, N); % or: x_step = (t >= 0);
% Exponential decay
a = 5;
x_exp = exp(-a*t);
% Rectangular pulse
x_rect = (t >= 0.2) & (t <= 0.4); % Pulse from 0.2 to 0.4s
% Impulse (approximation)
x_impulse = zeros(1, N);
x_impulse(1) = fs; % Scaled for unit areaPlotting Signals
Computing the Fourier Transform (FFT)
X = fft(x_sin); % Compute DFT
f = (0:N-1)*(fs/N); % Frequency vector
X_mag = abs(X)/N; % Magnitude (normalized)
% Plot single-sided spectrum
figure;
plot(f(1:N/2), 2*X_mag(1:N/2));
xlabel('Frequency (Hz)');
ylabel('|X(f)|');
title('Magnitude Spectrum');Convolution
Implementing Filters
Frequency Response
Z-Transform Analysis
Spectral Analysis
Tips for Signal Processing in Octave
- Always define a sampling rate and build time vectors from it
- Use
convfor linear convolution andfilterfor running a filter on streaming data - Normalize FFT output by dividing by $N$ for correct amplitude scaling
- Plot only positive frequencies (first $N/2$ bins) for real signals
- Use
freqzto visualize filter frequency response before applying it - The signal package provides
butter,cheby1,ellip,firls, and many more filter design functions
Key Takeaways
- GNU Octave provides free, MATLAB-compatible signal processing capabilities
- The
signalpackage adds essential functions:butter,freqz,pwelch,zplane - FFT + proper frequency axis construction gives magnitude spectra
convcomputes linear convolution;filterapplies difference equations- Octave scripts developed for coursework run directly in MATLAB with minimal modification
- Always verify filter designs by plotting frequency response before processing signals
Exam Focus
Revise definitions, diagrams, examples, and short-answer points for GNU Octave Basics for Signals.
Interview Use
Prepare one clear explanation, one practical example, and one common mistake for this Signals & Systems topic.
Search Terms
signal-systems, signals & systems, signal, systems, numerical, tools, octave, basics
Related Signals & Systems Topics