function [yNoisy,ps] = threeFrequencySpectrogram(t,fs)
% Generate noisy data and the power spectrum for a superposition of three
% sine waves.

% Set the fundamental frequency of the sinusoid, and how much that
% frequency can randomly vary.
baselineFrequency = 12;
frequencyVariation = 5;

% Generate three random frequencies centered around the fundamental
% frequency and its first and second harmonic.
freqs = (1:3)*baselineFrequency + (frequencyVariation*randn(1,3));

% Superpose three sinusoids of equal amplitude at those frequencies.
y = sum(sin(2*pi*freqs.*t'),2);

y = addBackground(y,t);
yNoisy = addNoise(y);

ps = computePowerSpectrum(yNoisy,fs);
end