Skip to content

q-ms8/signal-processing-psd-matlab

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 

Repository files navigation

📊 Power Spectral Density Analysis — MATLAB

MATLAB License Scripts Status

MATLAB implementations of Power Spectral Density (PSD) analysis, line coding schemes, pulse shaping techniques, and eye diagram generation for baseband digital communication systems.


✨ Features

  • 📊 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

📁 Project Structure

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

🚀 Getting Started

Prerequisites

  • MATLAB R2020a or later
  • Signal Processing Toolbox

How to Run

  1. Clone this repository:
    git clone https://github.com/q-ms8/signal-processing-psd-matlab.git
  2. Open MATLAB and navigate to the project folder
  3. Add the utils/ folder to your MATLAB path:
    >> addpath('utils')
  4. Run any script from main/:
    >> run('main/psd_line_coding.m')

📈 Main Scripts

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

🛠️ Utility Functions

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

🧮 Mathematical Background

Power Spectral Density

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+τ)]

Line Coding Schemes

Scheme Binary 1 Binary 0 DC Component
Polar NRZ +V −V None
Bipolar AMI ±V (alternating) 0 None
On-Off Keying +V 0 Present

📊 Sample Outputs

  • 📉 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)

📝 License

This project is licensed under the MIT License — see the LICENSE file for details.

About

Power Spectral Density analysis, line coding schemes (Polar/AMI/OOK), PAM pulse shaping, and eye diagram generation in MATLAB

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages