Skip to main content

Periodogram in MATLAB


Step 1: Signal Representation

Let the signal be x[n], where:

  • n = 0, 1, ..., N-1 (discrete-time indices),
  • N is the total number of samples.

Step 2: Compute the Discrete-Time Fourier Transform (DTFT)

The DTFT of x[n] is:

X(f) = ∑ x[n] e-j2πfn

For practical computation, the Discrete Fourier Transform (DFT) is used:

X[k] = ∑ x[n] e-j(2π/N)kn, k = 0, 1, ..., N-1

Here:

  • k represents discrete frequency bins,
  • f_k = k/N * f_s, where f_s is the sampling frequency.

Step 3: Compute Power Spectral Density (PSD)

The periodogram estimates the PSD as:

S_x(f_k) = (1/N) |X[k]|²

Where:

  • S_x(f_k) represents the power of the signal at frequency f_k.
  • The factor 1/N normalizes the power by the signal length.

Step 4: Convert to Decibels (Optional)

For visualization, convert PSD to decibels (dB):

S_xdB(f_k) = 10 log₁₀(S_x(f_k))

Practical Notes

  • Frequency Resolution: Depends on the signal duration T = N / f_s. Higher N gives finer frequency resolution.
  • Windowing (Optional): Use a window function (e.g., Hamming, Hann) to reduce spectral leakage: x'[n] = x[n] * w[n].
  • Frequency Range: PSD spans frequencies:
    • f_k = k/N * f_s for positive frequencies.
    • f_k = -(N-k)/N * f_s for negative frequencies.

     

    MATLAB Code

    clc;
    clear;
    close all;

    % Define signal parameters
    N = 256; % Number of samples
    fs = 1000; % Sampling frequency in Hz
    t = (0:N-1)/fs; % Time vector

    % Generate a sample signal (sum of two sinusoids)
    f1 = 50; % Frequency of first sinusoid in Hz
    f2 = 120; % Frequency of second sinusoid in Hz
    x = sin(2*pi*f1*t) + 0.5*sin(2*pi*f2*t) + randn(1, N)*0.1; % Signal with noise

    % Compute DFT of the signal
    X = fft(x, N);

    % Calculate the periodogram
    Pxx = (1/N) * abs(X).^2;

    % Generate frequency vector
    f = (0:N-1)*(fs/N);

    % Keep only the positive frequencies (up to Nyquist frequency)
    Pxx = Pxx(1:N/2+1);
    f = f(1:N/2+1);

    % Plot the periodogram
    figure;
    plot(f, 10*log10(Pxx), 'LineWidth', 1.5);
    xlabel('Frequency (Hz)');
    ylabel('Power/Frequency (dB/Hz)');
    title('Periodogram');
    grid on;

    Output 

     


     

     

     

     

    Copy the MATLAB Code above from here

     

    Further Reading

    1. Periodogram and Windowed Periododgram in details
    2. Correlogram in MATLAB
    3. Bartlett Method in MATLAB
    4. Blackman-Tukey Method in MATLAB
    5. Welch's Method in MATLAB

People are good at skipping over material they already know!

View Related Topics to

Periodogram in MATLAB







CATEGORY LIST :

  1. Modulation
  2. Signal Processing
  3. MATLAB
  4. Beamforming
  5. 5G
  6. Wireless
  7. Channel Impulse Response
  8. Fourier Transform
  9. ASK FSK PSK
  10. MIMO - Multiple Input Multiple Output
  11. Constellation Diagrams
  12. GATE-ESE-NET
  13. Programming
  14. Telecommunication
  15. Computer Networks
  16. Filters
  17. Fourier Series and Fourier Transform
  18. BER vs SNR
  19. Millimeter wave
  20. Pulse Modulation
  21. Python
  22. Equalizers
  23. Gaussian Random Variable
  24. QAM
  25. Applications and Games
  26. Electronics Industry
  27. Frequency bands
  28. Singular Value Decomposition (SVD)
  29. Spectral density estimation
  30. Wireless Communication Q & A
  31. Channel Estimation
  32. Channel Model
  33. Convolution
  34. Image Processing
  35. IoTs
  36. UWB
  37. pskmod
  38. Antenna
  39. C Programming
  40. Projects
  41. Q & A
  42. Raised cosine filter
  43. Rayleigh Fading
  44. Transform
  45. Alamouti's Scheme
  46. Fading
  47. Microwave
  48. News about 5G
  49. OFDM
  50. PAM
  51. PCM
  52. Python Matrix Operations
  53. SSC Exam
  54. Web Design
  55. Wide Sense Stationary
  56. WordPress
  57. Ionospheric Communication
  58. JavaScript
  59. MATLAB Simulink
  60. Mobile & Accessories
  61. Signal Processing for 5G
  62. Analog Circuits
  63. Cell Towers
  64. Computer
  65. Digital Circuits
  66. Fourier Series
  67. HomePage
  68. Information and Coding Theory
  69. Laplace Transform
  70. MySQL
  71. Node.js
  72. Search
  73. ShareLinkF
  74. Statistics
  75. Z Transform

Admin & Author: Salim

profile

  Website: www.salimwireless.com
  Interests: Signal Processing, Telecommunication, 5G Technology, Present & Future Wireless Technologies, Digital Signal Processing, Computer Networks, Millimeter Wave Band Channel, Web Development
  Seeking an opportunity in the Teaching or Electronics & Telecommunication domains.
  Possess M.Tech in Electronic Communication Systems.


Contact Us

Name

Email *

Message *

Popular Posts

MATLAB code for MSK

 Copy the MATLAB Code from here % The code is developed by SalimWireless.com clc; clear; close all; % Define a bit sequence bitSeq = [0, 1, 0, 0, 1, 1, 1, 0, 0, 1]; % Perform MSK modulation [modSignal, timeVec] = modulateMSK(bitSeq, 10, 10, 10000); % Plot the modulated signal subplot(2,1,1); samples = 1:numel(bitSeq); stem(samples, bitSeq); title('Original message signal'); xlabel('Time (s)'); ylabel('Amplitude'); % Plot the modulated signal subplot(2,1,2); samples = 1:10000; plot(samples / 10000, modSignal(1:10000)); title('MSK modulated signal'); xlabel('Time (s)'); ylabel('Amplitude'); % Perform MSK demodulation demodBits = demodMSK(modSignal, 10, 10, 10000); % Function to perform MSK modulation function [signal, timeVec] = modulateMSK(bits, carrierFreq, baudRate, sampleFreq) % Converts a binary bit sequence into an MSK-modulated signal % Inputs: % bits - Binary input sequence % carrierFreq - Carri...

MATLAB Code for BER performance of QPSK with BPSK, 4-QAM, 16-QAM, 64-QAM, 256-QAM, etc

  QPSK offers double the data rate of BPSK while maintaining a similar bit error rate at low SNR when Gray coding is used. It shares spectral efficiency with 4-QAM and can outperform 4-QAM or 16-QAM in very noisy channels. QPSK is widely used in practical wireless systems, often alongside QAM in adaptive modulation schemes [Read more...]   MATLAB Code clear all; close all; % Set parameters for QAM snr_dB = -20:2:20; % SNR values in dB qam_orders = [4, 16, 64, 256]; % QAM modulation orders % Loop through each QAM order and calculate theoretical BER figure; for qam_order = qam_orders     % Calculate theoretical BER using berawgn for QAM     ber_qam = berawgn(snr_dB, 'qam', qam_order);     % Plot the results for QAM     semilogy(snr_dB, ber_qam, 'o-', 'DisplayName', sprintf('%d-QAM', qam_order));     hold on; end % Set parameters for QPSK EbNoVec_qpsk = (-20:20)'; % Eb/No range for QPSK SNRlin_qpsk = 10.^(...

Constellation Diagrams of ASK, PSK, and FSK

BASK (Binary ASK) Modulation: Transmits one of two signals: 0 or -√Eb, where Eb​ is the energy per bit. These signals represent binary 0 and 1.    BFSK (Binary FSK) Modulation: Transmits one of two signals: +√Eb​ ( On the y-axis, the phase shift of 90 degrees with respect to the x-axis, which is also termed phase offset ) or √Eb (on x-axis), where Eb​ is the energy per bit. These signals represent binary 0 and 1.  BPSK (Binary PSK) Modulation: Transmits one of two signals: +√Eb​ or -√Eb (they differ by 180 degree phase shift), where Eb​ is the energy per bit. These signals represent binary 0 and 1.    Simulator for BASK, BPSK, and BFSK Constellation Diagrams SNR (dB): 15 Add AWGN Noise Modulation Type BPSK BFSK ...

BER vs SNR for M-ary QAM, M-ary PSK, QPSK, BPSK, ...

📘 Overview of BER and SNR 🧮 Simulator for m-ary QAM and m-ary PSK 🧮 MATLAB Codes 📚 Further Reading Modulation Constellation Diagrams BER vs. SNR BER vs SNR for M-QAM, M-PSK, QPSk, BPSK, ... What is Bit Error Rate (BER)? The abbreviation BER stands for bit error rate, which indicates how many corrupted bits are received (after the demodulation process) compared to the total number of bits sent in a communication process. It is defined as,  In mathematics, BER = (number of bits received in error / total number of transmitted bits)  On the other hand, SNR refers to the signal-to-noise power ratio. For ease of calculation, we commonly convert it to dB or decibels.   What is Signal the signal-to-noise ratio (SNR)? SNR = signal power/noise power (SNR is a ratio of signal power to noise power) SNR (in dB) = 10*log(signal power / noise power) [base 10] For instance,...

Theoretical and simulated BER vs. SNR for ASK, FSK, and PSK

📘 Overview 🧮 Simulator for calculating BER 🧮 MATLAB Codes for calculating theoretical BER 🧮 MATLAB Codes for calculating simulated BER 📚 Further Reading   BER vs. SNR denotes how many bits in error are received in a communication process for a particular Signal-to-noise (SNR) ratio. In most cases, SNR is measured in decibel (dB). For a typical communication system, a signal is often affected by two types of noises 1. Additive White Gaussian Noise (AWGN) 2. Rayleigh Fading In the case of additive white Gaussian noise (AWGN), random magnitude is added to the transmitted signal. On the other hand, Rayleigh fading (due to multipath) attenuates the different frequency components of a signal differently. A good signal-to-noise ratio tries to mitigate the effect of noise.  Simulator for calculating BER vs SNR for binary ASK, FSK, and PSK Calculate BER for Binary ASK Modulation The theoretical BER for binary ASK (BASK) in an AWGN channel is...

Comparisons among ASK, PSK, and FSK | And the definitions of each

📘 Overview 🧮 Simulator 🧮 Noise Sensitivity, Bandwidth, Complexity, etc. 🧮 MATLAB Codes 🧮 Some Questions and Answers 📚 Further Reading Modulation ASK, FSK & PSK Constellation MATLAB Simulink MATLAB Code Comparisons among ASK, PSK, and FSK    Comparisons among ASK, PSK, and FSK   Simulator for Calculating Bandwidth of ASK, FSK, and PSK The baud rate represents the number of symbols transmitted per second. Both baud rate and bit rate are same for binary ASK, FSK, and PSK. Select Modulation Type: ASK FSK PSK Baud Rate or Bit Rate (bps): Frequency Deviation (Hz) for FSK: Calculate Bandwidth Comparison among ASK,  FSK, and PSK Performance Comparison: 1. Noise Sensitivity:    - ASK is the most sensitive to noise due to its r...

MATLAB Code for QAM (Quadrature Amplitude Modulation)

📘 Overview of QAM 🧮 MATLAB Code for 4-QAM 🧮 MATLAB Code for 16-QAM 🧮 MATLAB Code for m-ary QAM (4-QAM, 16-QAM, 32-QAM, ...) 📚 Further Reading   One of the best-performing modulation techniques is QAM [↗] . Here, we modulate the symbols by varying the carrier signal's amplitude and phase in response to the variation in the message signal (or voltage variation). So, we may say that QAM is a combination of phase and amplitude modulation. Additionally, it performs better than ASK or PSK [↗] . In fact, any constellation for any type of modulation, signal set (or, symbols) is structured in a way that prevents them from interacting further by being distinct by phase, amplitude, or frequency. MATLAB Script (for 4-QAM) % This code is written by SalimWirelss.Com % This is an example of 4-QAM. Here constellation size is 4 % or total number of symbols/signals is 4 % We need 2 bits once to represent four constellation points % QAM modulation is the combina...