-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathBart.m
55 lines (27 loc) · 829 Bytes
/
Bart.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
function Px = Bart(x,nsect)
%BART Bartlett's method of periodogram averaging.
%----
%USAGE Px = Bart(x,nsect)
%
% The spectrum of a process x is estimated using Bartlett's
% method of periodogrm averaging.
%
% x : Input sequence
% nsect : Number of subsequences to be used in the average
%
% The Bartlett estimate is returned in Px using a linear scale.
%
% see also PER, MPER, WELCH, and SPER
%
%---------------------------------------------------------------
% copyright 1996, by M.H. Hayes. For use with the book
% "Statistical Digital Signal Processing and Modeling"
% (John Wiley & Sons, 1996).
%---------------------------------------------------------------
L = floor(length(x)/nsect);
Px = 0;
n1 = 1;
for i=1:nsect
Px = Px + per(x(n1:n1+L-1))/nsect;
n1 = n1 + L;
end;