MATLAB implementations of Power Spectral Density (PSD) analysis, line coding schemes, pulse shaping techniques, and eye diagram generation for baseband digital communication systems.
- 📊 PSD Analysis — Welch's method and Wiener-Khinchin theorem implementations
- 📡 Line Coding — Polar NRZ, Bipolar AMI, On-Off Keying (OOK) comparison
- 🔄 Pulse Shaping — Rectangular (RZ/NRZ), raised cosine, and half-sine pulses
- 👁️ Eye Diagrams — Visual assessment of inter-symbol interference (ISI)
- 📈 FFT Analysis — Spectral decomposition of multi-frequency signals
signal-processing-psd-matlab/
├── main/
│ ├── psd_line_coding.m # PSD of Polar, AMI, and OOK line codes
│ ├── pam_pulse_shaping.m # PAM2 waveforms with 4 pulse shapes
│ ├── psd_autocorrelation.m # PSD via autocorrelation (Wiener-Khinchin)
│ └── fft_piecewise_signal.m # FFT spectral analysis of composite signals
│
└── utils/
├── eyeplot.m # Eye diagram plotting utility
├── pnrz.m # Polar Non-Return-to-Zero pulse generator
├── prcos.m # Raised cosine pulse generator
├── prz.m # Polar Return-to-Zero pulse generator
└── psine.m # Half-sine pulse generator
- MATLAB R2020a or later
- Signal Processing Toolbox
- Clone this repository:
git clone https://github.com/q-ms8/signal-processing-psd-matlab.git
- Open MATLAB and navigate to the project folder
- Add the
utils/folder to your MATLAB path:>> addpath('utils') - Run any script from
main/:>> run('main/psd_line_coding.m')
| Script | Description | Key Concepts |
|---|---|---|
psd_line_coding.m |
Compares PSD of three line coding schemes: Polar, Bipolar AMI, and OOK | pwelch(), line codes, spectral analysis |
pam_pulse_shaping.m |
Generates PAM2 waveforms with RZ, NRZ, half-sine, and raised cosine pulses | Pulse shaping, upsample(), conv() |
psd_autocorrelation.m |
Computes PSD via autocorrelation function and FFT (Wiener-Khinchin theorem) | xcorr(), fft(), fftshift() |
fft_piecewise_signal.m |
FFT analysis of a piecewise signal with 50, 100, and 150 Hz components | fft(), single/double-sided spectrum |
| Function | Signature | Description |
|---|---|---|
eyeplot.m |
eyeplot(signal, T) |
Overlays symbol-period segments to create an eye diagram |
pnrz.m |
pnrz(T) |
Generates a Polar NRZ rectangular pulse of width T |
prz.m |
prz(T) |
Generates a Polar RZ pulse (width T/2, centered in T) |
prcos.m |
prcos(rolloff, T, rate) |
Generates a raised cosine pulse with configurable rolloff |
psine.m |
psine(T) |
Generates a half-sine pulse of width T |
The PSD describes how power is distributed across frequency:
Welch's Method: Divide signal into overlapping segments, window each, compute periodogram, and average.
Wiener-Khinchin Theorem: PSD is the Fourier transform of the autocorrelation function:
S(f) = F{R(τ)} where R(τ) = E[x(t) · x(t+τ)]
| Scheme | Binary 1 | Binary 0 | DC Component |
|---|---|---|---|
| Polar NRZ | +V | −V | None |
| Bipolar AMI | ±V (alternating) | 0 | None |
| On-Off Keying | +V | 0 | Present |
- 📉 PSD plots comparing spectral characteristics of different line codes
- 👁️ Eye diagrams showing ISI-free and ISI-affected signals
- 📈 Single-sided and double-sided FFT spectrum plots
- 🔄 Pulse shape waveforms (RZ, NRZ, raised cosine, half-sine)
This project is licensed under the MIT License — see the LICENSE file for details.