function [yNoisy,ps] = gauspulsSpectrogram(t,fs)
% Generate noisy data and the power spectrum for a Gaussian pulse at a
% random start time, with a random center frequency and fractional
% bandwidth, using gauspuls.

% Set the start time, center frequency, and fractional 
% width of the pulse to randomly vary.
baselineStartTime = 2.5;
startVariation = 0.2;
baselineCenter = 8;
centerVariation = 2;
baselineWidth = 0.2;
widthVariation = 0.05;

% Generate parameters.
start = baselineStartTime + startVariation*randn;
center = baselineCenter + centerVariation*randn;
width = baselineWidth + widthVariation*randn;

% Generate time series with background and noise.
yClean = gauspuls(t-start,center,width);
yClean = addBackground(yClean,t);
yNoisy = addNoise(yClean);

ps = computePowerSpectrum(yNoisy,fs);
end