MATLAB Basics
MATLAB is a high-level programming language and numerical computing environment widely used in electrical engineering for signal processing, control systems, and data analysis. For this unit, it's the primary tool you'll use to model systems and analyze signals, so getting comfortable with its environment is essential.
MATLAB Environment and Programming
Scripts are plain text files (.m files) containing a sequence of commands that execute together. They're useful for automating repetitive tasks and keeping your work reproducible.
Functions are self-contained units of code that accept input arguments, perform a specific task, and return output values. The difference from scripts matters: functions let you write modular, reusable code instead of copying and pasting the same block over and over.
At its core, MATLAB treats everything as a matrix or array. Numerical computing in MATLAB revolves around operations on these structures:
- Element-wise arithmetic (adding, multiplying arrays element by element)
- Matrix multiplication (following linear algebra rules)
- Solving systems of linear equations (e.g., )
This matrix-first design is why MATLAB is so natural for engineering work, where you're constantly dealing with vectors of data and systems of equations.
Data Visualization and Toolboxes
MATLAB includes a wide range of plotting functions for 2D and 3D visualization: line plots, scatter plots, surface plots, and more. Being able to quickly plot a signal or a system response is one of the biggest practical advantages of working in MATLAB.
Toolboxes are add-on collections of specialized functions for specific domains. The two most relevant for this unit:
- Signal Processing Toolbox provides functions for spectral analysis, filter design, and signal generation
- Control System Toolbox provides functions for modeling, analyzing, and designing control systems
These toolboxes save significant development time because the algorithms are already implemented and tested.

Signal Processing
Signal processing is the analysis, manipulation, and interpretation of signals. A signal is any time-varying or spatially-varying quantity that carries information, such as an audio waveform, a sensor reading, or an image.
Fourier Transforms and Filtering
The Fourier transform decomposes a signal into its constituent frequencies. Instead of looking at how a signal changes over time (time domain), you can see which frequencies are present and how strong they are (frequency domain). This frequency-domain view is often where the real insight lives.
Two key variants you'll use:
- Discrete Fourier Transform (DFT): the mathematical definition for sampled (discrete) data
- Fast Fourier Transform (FFT): a computationally efficient algorithm for calculating the DFT. In MATLAB, you call
fft()to compute it.
Filtering selectively modifies or removes certain frequency components from a signal. Common filter types:
- Low-pass filter: keeps low frequencies, removes high frequencies (useful for smoothing or removing high-frequency noise)
- High-pass filter: keeps high frequencies, removes low frequencies (useful for removing slow drift or DC offset)
- Band-pass filter: keeps only frequencies within a specific range
In MATLAB, the filter() function applies a digital filter to a signal. The Signal Processing Toolbox also provides design tools like designfilt() to help you create filters with specific characteristics.

Signal Processing Applications and Techniques
These techniques show up across many domains: audio and speech processing, image and video processing, and biomedical signal analysis (ECG heart signals, EEG brain signals).
For signals whose frequency content changes over time (called non-stationary signals), standard Fourier transforms aren't enough because they give you a global frequency picture with no time information. Two methods handle this:
- Short-Time Fourier Transform (STFT): chops the signal into short overlapping windows and computes the FFT of each window, giving you frequency content at each point in time
- Wavelet transform: uses variable-length windows, providing better time resolution at high frequencies and better frequency resolution at low frequencies
Statistical signal processing techniques like power spectral density estimation and adaptive filtering help you characterize and process signals when noise and uncertainty are present. MATLAB's Signal Processing Toolbox covers all of these, including signal generation, spectral analysis, filter design, and feature extraction.
System Analysis and Design
System analysis studies dynamic systems, which are systems whose behavior evolves over time based on inputs, outputs, and internal states. Electrical circuits, mechanical systems, and feedback control systems are all examples.
Control System Design and Analysis
Control system design develops strategies for making a dynamic system behave the way you want. The typical goals are stability (the system doesn't blow up), good transient response (it responds quickly without excessive oscillation), and robustness (it still works when conditions change).
MATLAB represents systems using several standard models:
- Transfer functions: express the input-output relationship as a ratio of polynomials in (continuous) or (discrete)
- State-space models: represent the system using matrices that describe how internal states evolve over time (, )
- Block diagrams: visual representations of interconnected subsystems
The Control System Toolbox provides analysis and design functions including:
- Root locus analysis: shows how system poles move as a gain parameter changes, helping you assess stability
- Bode plots: display magnitude and phase response versus frequency, useful for understanding how a system responds to different input frequencies
- PID controller tuning: helps you set proportional, integral, and derivative gains for a common controller structure
Data Visualization and System Identification
Visualizing system behavior is critical for understanding what's happening. MATLAB's plotting functions let you generate:
- Step response: how the system reacts to a sudden input change
- Frequency response: how the system handles different input frequencies
- Pole-zero maps: locations of poles and zeros in the complex plane, which directly indicate stability and dynamic behavior
System identification is the process of estimating a mathematical model of a system from measured input-output data. This is how you go from real-world experimental measurements to a model you can simulate and design controllers for.
MATLAB's System Identification Toolbox supports estimating various model types from data, including ARX models (a common linear model structure), state-space models, and nonlinear models. Data-driven approaches like machine learning and statistical modeling can also be applied in MATLAB to improve system performance when traditional modeling is difficult.