function y = sumofsines(omega, alpha, t)
% Y = SUMOFSINES(OMEGA, ALPHA, T) creates a vector Y consisting of a sum of
% stationary sinusoids with frequencies OMEGA and amplitudes 2*ALPHA. The
% vector is defined in the interval T.
%
% Input:
% ------
%     omega [1xK] : frequencies
%     alpha [1xK] : amplitudes
%     t     [1xL] : time vector
%
% Output:
% -------
%     y     [1xL] : sum of sinusoids
%
% Example:  w = [2*pi*200 2*pi*400];
%           a = [1 2];
%           fs = 8000;
%           t = 0:1/fs:1;
%           y = sumofsines(w, a, t);
%            
% @ G.P. Kafentzis, CSD, UoC, 2010.

omega = reshape(omega, length(omega), 1);
t = reshape(t, 1, length(t));
y = sum(2 * alpha * cos(omega * t), 1);
plot(t, y); title('Sum of sinusoids'); xlabel('Time (s)');
y = reshape(y, length(y), 1);