function yV = addseasonality(xV,per)
% yV = addseasonality(xV,per)
% ADDSEASONALITY adds a seasonal component to a given time series (for
% simulating purposes). The time series of seasonality is generated by
% cosine function of a given period 'per' and amplitude equal to the
% standard deviation of the given time series.
% INPUT
% - xV      : vector of length 'n' of the given time series
% - per     : the season (period)
% OUTPUT
% - yV      : vector of length 'n' of the sum of the given time series and
%             the time series of seasonality.

n = length(xV);
xV = xV(:);
xsd = std(xV);
zV = xsd*cos(2*pi*[1:n]'/per);
yV = xV + zV;
