%% Comparison with Euclidean Norm
% Create a signal consisting of a 100 Hz sine wave in additive N(0,1) white Gaussian noise. The sampling frequency is 1 kHz. Determine the average power and compare it against the \ell_2 norm.

t = 0:0.001:1-0.001;
x = cos(2*pi*100*t)+randn(size(t));

p = bandpower(x)
l2norm = norm(x,2)^2/numel(x)

% Copyright 2015 The MathWorks, Inc.