Skip to main content

Bartlett Method in MATLAB


Steps to calculate Spectral power density using Bartlett Method

  1. 'M' is the length of each segment for the Bartlett method, set to 100 samples.
  2. 'K' is the number of segments obtained by dividing the total number of samples N by the segment length 'M'.
  3. psd_bartlett_broadband is initialized to store the accumulated periodogram.
  4. For each segment k, x_k extracts the k-th segment of the broadband signal.
  5. P_k computes the periodogram of the k-th segment using the FFT.
  6. The periodograms are accumulated and averaged over all segments.
  7. The PSD is plotted in dB/Hz by converting the power values to decibels using 10 * log10.

 

MATLAB Script


clc;
clear;
close all;

% Parameters
fs = 1000; % Sampling frequency
t = 0:1/fs:1-1/fs; % Time vector
N = length(t); % Number of samples

% Generate synthetic broadband ARMA process
arma_order = [2, 2]; % ARMA(p,q) order
a = [1, -0.75, 0.5]; % AR coefficients
b = [1, 0.4, 0.3]; % MA coefficients
%broadband_signal = filter(b, a, randn(size(t)));
% Generate sinusoids with different frequencies
frequencies = [50, 150, 300, 450]; % Frequencies in Hz
amplitudes = [1, 0.8, 0.6, 0.4]; % Amplitudes
broadband_input = zeros(size(t));

for i = 1:length(frequencies)
    broadband_input = broadband_input + amplitudes(i) * sin(2*pi*frequencies(i)*t);
end

% Add noise for realism (optional)
broadband_signal = broadband_input + 0.2*randn(size(t));
broadband_signal = filter(b, a, broadband_signal);

% Generate synthetic narrowband process
f0 = 50; % Center frequency of narrowband process
narrowband_signal = sin(2*pi*f0*t) + 0.5*randn(size(t));

% Parameters for Bartlett method
M = 100; % Length of each segment
K = N / M; % Number of segments

% Initialize the PSD estimate for broadband signal
psd_bartlett_broadband = zeros(1, M);

% Loop over each segment for broadband signal
for k = 1:K
    % Extract the k-th segment
    x_k = broadband_signal((k-1)*M + (1:M));

    % Compute the periodogram of the k-th segment
    P_k = abs(fft(x_k, M)).^2 / M;

    % Accumulate the periodogram
    psd_bartlett_broadband = psd_bartlett_broadband + P_k;
end

% Average the periodograms
psd_bartlett_broadband = psd_bartlett_broadband / K;

% Initialize the PSD estimate for narrowband signal
psd_bartlett_narrowband = zeros(1, M);

% Loop over each segment for narrowband signal
for k = 1:K
    % Extract the k-th segment
    x_k = narrowband_signal((k-1)*M + (1:M));

    % Compute the periodogram of the k-th segment
    P_k = abs(fft(x_k, M)).^2 / M;

    % Accumulate the periodogram
    psd_bartlett_narrowband = psd_bartlett_narrowband + P_k;
end

% Average the periodograms
psd_bartlett_narrowband = psd_bartlett_narrowband / K;

% Frequency axis
f = (0:M-1)*(fs/M);

% Plot the PSD for broadband signal
figure;
plot(f(1:50), 10*log10(psd_bartlett_broadband(1:50)));
title('Power Spectral Density (Bartlett Method) - Broadband Signal');
xlabel('Frequency (Hz)');
ylabel('Power/Frequency (dB/Hz)');

% Plot the PSD for narrowband signal
figure;
plot(f(1:50), 10*log10(psd_bartlett_narrowband(1:50)));
title('Power Spectral Density (Bartlett Method) - Narrowband Signal');
xlabel('Frequency (Hz)');
ylabel('Power/Frequency (dB/Hz)');
web('https://www.salimwireless.com/search?q=spectral%20estimation', '-browser');
 

Output

Bartlett Narrowband PSD
Bartlett Method PSD for Narrowband Signal
 
Bartlett Broadband PSD
Bartlett Method PSD for Broadband Signal
 

Further Reading

  1. Periodogram in MATLAB
  2. Welch Method for Spectral Estimation in MATLAB
  3. Correlogram in MATLAB
  4. Power Spectral Density Calculation Using Simple FFT in MATLAB
  5. Spectral Estimation Methods - Periodogram, Correlogram, Welch, Bartlett ... (Theory)

People are good at skipping over material they already know!

View Related Topics to







Contact Us

Name

Email *

Message *

Popular Posts

BER vs SNR for M-ary QAM, M-ary PSK, QPSK, BPSK, ...(MATLAB Code + Simulator)

Bit Error Rate (BER) & SNR Guide Analyze communication system performance with our interactive simulators and MATLAB tools. ๐Ÿ“˜ Theory ๐Ÿงฎ Simulators ๐Ÿ’ป MATLAB Code ๐Ÿ“š Resources BER Definition SNR Formula BER Calculator MATLAB Comparison ๐Ÿ“‚ Explore M-ary QAM, PSK, and QPSK Topics ▼ ๐Ÿงฎ Constellation Simulator: M-ary QAM ๐Ÿงฎ Constellation Simulator: M-ary PSK ๐Ÿงฎ BER calculation for ASK, FSK, and PSK ๐Ÿงฎ Approaches to BER vs SNR What is Bit Error Rate (BER)? The BER indicates how many corrupted bits are received compared to the total number of bits sent. It is the primary figure of merit for a...

Online Simulator for ASK, FSK, and PSK

Try our new Digital Signal Processing Simulator!   •   Interactive ASK, FSK, and BPSK tools updated for 2025. Start Now Interactive Modulation Simulators Visualize binary modulation techniques (ASK, FSK, BPSK) in real-time with adjustable carrier and sampling parameters. ๐Ÿ“ก ASK Simulator ๐Ÿ“ถ FSK Simulator ๐ŸŽš️ BPSK Simulator ๐Ÿ“š More Topics ASK Modulator FSK Modulator BPSK Modulator More Topics Simulator for Binary ASK Modulation Digital Message Bits Carrier Freq (Hz) Sampling Rate (...

Constellation Diagrams of ASK, PSK, and FSK (with MATLAB Code + Simulator)

Constellation Diagrams: ASK, FSK, and PSK Comprehensive guide to signal space representation, including interactive simulators and MATLAB implementations. ๐Ÿ“˜ Overview ๐Ÿงฎ Simulator ⚖️ Theory ๐Ÿ“š Resources Definitions Constellation Tool Key Points MATLAB Code ๐Ÿ“‚ Other Topics: M-ary PSK & QAM Diagrams ▼ ๐Ÿงฎ Simulator for M-ary PSK Constellation ๐Ÿงฎ Simulator for M-ary QAM Constellation 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 ...

Online Simulator for Frequency Modulatiuon

Frequency Modulation Message Frequency (Hz): Generate Message Carrier Frequency (Hz): Generate Carrier Message Signal Amplitude: Carrier Signal Amplitude: Generate Modulated Signal Demodulate Further Reading  Amplitude Modulation Simulator Phase Modulation Simulator  Explore DSP Simulations   Online Signal Processing Simulations Home Page >

Time / Frequency Separation for Orthogonality

๐Ÿ“˜ Theory ๐Ÿ“ Derivation ๐Ÿ“Š Examples ๐Ÿงฎ Simulator Try the Interactive BFSK / FM Simulator Visualize modulation and understand concepts faster. Launch BFSK Simulator Launch FM Simulator BFSK Orthogonality Simulator Derivation of Frequency Separation for Orthogonality Step 1: Define BFSK Signals Copy s₁(t) = √(2E b /T) cos(2ฯ€f₁t) Copy s₂(t) = √(2E b /T) cos(2ฯ€f₂t) Defined over: 0 ≤ t ≤ T For orthogonality: Copy ∫₀แต€ s₁(t)s₂(t) dt = 0 Step 2: Remove Constants Copy ∫₀แต€ cos(2ฯ€f₁t) cos(2ฯ€f₂t) dt = 0 Step 3: Use Trigonometric Identity Copy cos A cos B = ½ [ cos(A − B) + cos(A + B) ] Applying identity: Copy ½ ∫₀แต€ [ cos(2ฯ€(f₁ − f₂)t) + cos(2ฯ€(f₁ + f₂)t) ] dt Ste...

UGC NET Electronic Science Previous Year Question Papers

Home / Engineering & Other Exams / UGC NET 2022 PYQ ๐Ÿ“ฅ Download UGC NET Electronics PDFs Complete collection of previous year question papers, answer keys and explanations for Subject Code 88. Start Downloading UGC-NET (Electronics Science, Subject code: 88) Subject_Code : 88; Department : Electronic Science; ๐Ÿ“‚ View All Question Papers UGC Net Electronic Science Question Paper With Answer Key Download Pdf [June 2025] with full explanation UGC Net Electronic Science Question Paper With Answer Key Download Pdf [December 2024] UGC Net Paper 1 With Answer Key Download Pdf [Sep 2024] with full explanation UGC Net Electronic Science Question Paper With Answer Key Download Pdf [Aug 2024] with full explanation UGC Net Paper 1 With Answer Key Download...

FM Modulation Online Simulator

Frequency Modulation Simulator Message Frequency (fm): Hz Carrier Frequency (fc): Hz Carrier Amplitude (Ac): Modulation Index (ฮฒ): Frequency deviation ฮ”f = ฮฒ × fm Online Signal Processing Simulations Home Page >

Comparisons among ASK, PSK, and FSK (with MATLAB + Simulator)

๐Ÿ“˜ Comparisons among ASK, FSK, and PSK ๐Ÿงฎ Online Simulator for calculating Bandwidth of ASK, FSK, and PSK ๐Ÿงฎ MATLAB Code for BER vs. SNR Analysis of ASK, FSK, and PSK ๐Ÿ“š Further Reading ๐Ÿ“‚ View Other Topics on Comparisons among ASK, PSK, and FSK ... ๐Ÿงฎ Comparisons of Noise Sensitivity, Bandwidth, Complexity, etc. ๐Ÿงฎ MATLAB Code for Constellation Diagrams of ASK, FSK, and PSK ๐Ÿงฎ Online Simulator for ASK, FSK, and PSK Generation ๐Ÿงฎ Online Simulator for ASK, FSK, and PSK Constellation ๐Ÿงฎ Some Questions and Answers Modulation ASK, FSK & PSK Constellation MATLAB Simulink MATLAB Code Comparisons among ASK, PSK, and FSK    Comparisons among ASK, PSK, and FSK Comparison among ASK, FSK, and PSK Parameters ASK FSK PSK Variable Characteristics Amplitude Frequency ...