% Matlab script to explore aliasing.
%
% by Gary Scavone, McGill University, 2020.

A = 0.5;                % signal amplitude
fs = 10000;             % sample rate
N = fs*2;               % # of samples to compute
f = [1000 3000 9000].'; % frequencies to compute

y = A*sin(f*(2*pi*(0:N-1)/fs));  % create row-vectors of sound

sound(reshape(y.', 3*N, 1), fs); % play sequentially