Why does the PERIODOGRAM function give no output when used

Q
Quincy · Mar 15, 2021 · 1.9K views
Question
Why does the PERIODOGRAM function give no output when used with the SUBPLOT function in Signal Processing Toolbox 6.2 (R14)? I have two data sets for which I want periodograms. When I try to plot them in the same figure using SUBPLOT, I obtain two empty axes. I used the following code:       x1=rand(1,100); x2=rand(1,100); subplot(2,1,1) periodogram(x1); subplot(2,1,2) periodogram(x2);  
Expert Answer
Profile picture of Neeta Dsouza
Neeta Dsouza PhD Expert
Answered Aug 12, 2026

The periodogram function in MATLAB might give no output for several reasons. Here are a few common issues and solutions:

  1. Empty Input Signal: Ensure that your input signal x is not empty. If the signal is empty, the periodogram function will not produce any output.

  2. Incorrect Axes: If you're using subplot to plot multiple periodograms, make sure you're specifying the correct axes. Sometimes, the axes might not be properly initialized.

  3. Data Type Issues: Verify that the input signal is of a compatible data type (e.g., double or single). If the data type is not supported, the function might fail silently.

  4. Window and FFT Parameters: Check the parameters for the window and FFT (e.g., window, nfft). Incorrect parameters can lead to unexpected results or no output.

Example Code

Here's an example of how to use the periodogram function correctly:

matlab
% Generate a sample signal
fs = 1000; % Sampling frequency
t = 0:1/fs:1-1/fs;
x = sin(2*pi*50*t) + 0.5*randn(size(t)); % Signal with noise

% Compute the periodogram
[pxx, f] = periodogram(x, [], [], fs);

% Plot the periodogram
figure;
plot(f, 10*log10(pxx));
title('Periodogram of the Signal');
xlabel('Frequency (Hz)');
ylabel('Power/Frequency (dB/Hz)');
100% Run Guarantee 3-Hour Fast-Track Delivery

Need a Custom Version or Complete Simulation for This Problem?

Our 500+ PhD engineers build, debug, and optimize working MATLAB scripts and Simulink (.slx) models tailored to your exact assignment rubrics with zero plagiarism.

Tested on MATLAB R2024b / R2026a
Turnitin 0% Plagiarism Report
Free 7-Day Revisions Guarantee
Have a different question? Ask here

Get a Free Consultation or a Sample Assignment Review!