www.gusucode.com > signal 案例源码程序 matlab代码 > signal/AveragePowerOfAMultichannelSignalExample.m
%% Average Power of a Multichannel Signal % Create a multichannel signal consisting of three sinusoids in additive % _N_(0,1) white Gaussian noise. The sinusoids' frequencies are 100 Hz, 200 % Hz, and 300 Hz. The sampling frequency is 1 kHz, and the signal has a % duration of 1 s. % Copyright 2015 The MathWorks, Inc. %% Fs = 1000; t = 0:1/Fs:1-1/Fs; f = [100;200;300]; x = cos(2*pi*f*t)'+randn(length(t),3); %% % Determine the average power of the signal and compare it to the $\ell_2$ % norm. p = bandpower(x) l2norm = dot(x,x)/length(x)