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

Online Simulator for ASK, FSK, and PSK

Try our new Digital Signal Processing Simulator!   Start Simulator for binary ASK Modulation Message Bits (e.g. 1,0,1,0) Carrier Frequency (Hz) Sampling Frequency (Hz) Run Simulation Simulator for binary FSK Modulation Input Bits (e.g. 1,0,1,0) Freq for '1' (Hz) Freq for '0' (Hz) Sampling Rate (Hz) Visualize FSK Signal Simulator for BPSK Modulation ...

Constellation Diagrams of ASK, PSK, and FSK

📘 Overview of Energy per Bit (Eb / N0) 🧮 Online Simulator for constellation diagrams of ASK, FSK, and PSK 🧮 Theory behind Constellation Diagrams of ASK, FSK, and PSK 🧮 MATLAB Codes for Constellation Diagrams of ASK, FSK, and PSK 📚 Further Reading 📂 Other Topics on Constellation Diagrams of ASK, PSK, and FSK ... 🧮 Simulator for constellation diagrams of m-ary PSK 🧮 Simulator for constellation diagrams of m-ary QAM 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...

Power Spectral Density Calculation Using FFT in MATLAB

📘 Overview 🧮 Steps to calculate the PSD of a signal 🧮 MATLAB Codes 📚 Further Reading Power spectral density (PSD) tells us how the power of a signal is distributed across different frequency components, whereas Fourier Magnitude gives you the amplitude (or strength) of each frequency component in the signal. Steps to calculate the PSD of a signal Firstly, calculate the first Fourier transform (FFT) of a signal Then, calculate the Fourier magnitude of the signal The power spectrum is the square of the Fourier magnitude To calculate power spectrum density (PSD), divide the power spectrum by the total number of samples and the frequency resolution. {Frequency resolution = (sampling frequency / total number of samples)} Sampling frequency (fs): The rate at which the continuous-time signal is sampled (in Hz). ...

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

📘 Overview of BER and SNR 🧮 Online Simulator for BER calculation of m-ary QAM and m-ary PSK 🧮 MATLAB Code for BER calculation of M-ary QAM, M-ary PSK, QPSK, BPSK, ... 📚 Further Reading 📂 View Other Topics on M-ary QAM, M-ary PSK, QPSK ... 🧮 Online Simulator for Constellation Diagram of m-ary QAM 🧮 Online Simulator for Constellation Diagram of m-ary PSK 🧮 MATLAB Code for BER calculation of ASK, FSK, and PSK 🧮 MATLAB Code for BER calculation of Alamouti Scheme 🧮 Different approaches to calculate BER vs SNR 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. BER = (number of bits received in error) / (total number of tran...

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

📘 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 ...

What are the main lobe and side lobes in Beamforming

    What are the main lobe and side lobes in Beamforming? You've probably noticed that in the diagram of  beamforming , there are two types of lobes in beamforming patterns. One is the main lobe, while the others are side lobes. We intend to communicate with receivers with a stronger directional path from the transmitter when we produce beams for wireless communication. We can also see side lobes in this scenario. These side lobes, on the other hand, are not necessary for effective communication. As a result, we take various procedures to remove those side lobes or to reduce the number of side lobes as much as feasible; otherwise, inter-symbol interference  occurs, and signal quality suffers. Figure: Illustration of Main Lobe and Side lobes, where the x-axis denotes the angle of arrival (AOA) and angle of departure (AOD), respectively, while, the y-axis denotes the gain/power in dB (decibel).     In the case of MIMO antennas, our major goal is to reduce int...

MATLAB Code for Pulse Amplitude Modulation (PAM) and Demodulation

Pulse Amplitude Modulation (PAM) & Demodulation 📘 Overview & Theory of Pulse Amplitude Modulation (PAM) 🧮 MATLAB Code for Pulse Amplitude Modulation and Demodulation of Analog Signal and Digital Signal 🧮 Simulation Results for Comparison of PAM, PWM, PPM, DM, and PCM 📚 Further Reading 📂 Other Topics on Pulse Amplitude Modulation ... 🧮 MATLAB Code for Pulse Amplitude Modulation and Demodulation of an Analog Signal (2) 🧮 MATLAB Code for Pulse Amplitude Modulation and Demodulation of Digital Data 🧮 Other Pulse Modulation Techniques (PWM, PPM, DM, PCM) Pulse Amplitude Modulation (PAM) & Demodulation of an Analog Message Signal MATLAB Script clc; clear all; close all; fm = 10; % frequency of the message signal fc = 100; % frequency of the carrier signal fs = 100...

Coherence Bandwidth and Coherence Time

🧮 Coherence Bandwidth 🧮 Coherence Time 🧮 MATLAB Code s 📚 Further Reading For Doppler Delay or Multi-path Delay Coherence time T coh ∝ 1 / v max (For slow fading, coherence time T coh is greater than the signaling interval.) Coherence bandwidth W coh ∝ 1 / Ï„ max (For frequency-flat fading, coherence bandwidth W coh is greater than the signaling bandwidth.) Where: T coh = coherence time W coh = coherence bandwidth v max = maximum Doppler frequency (or maximum Doppler shift) Ï„ max = maximum excess delay (maximum time delay spread) Notes: The notation v max −1 and Ï„ max −1 indicate inverse proportionality. Doppler spread refers to the range of frequency shifts caused by relative motion, determining T coh . Delay spread (or multipath delay spread) determines W coh . Frequency-flat fading occurs when W coh is greater than the signaling bandwidth. Coherence Bandwidth Coherence bandwidth is...