Home > wafo > onedim > private > bingham.m

# bingham

## PURPOSE

returns the N-point Bingham window in a column vector.

w = bingham(n,p)

## DESCRIPTION

```  BINGHAM  returns the N-point Bingham window in a column vector.

CALL: win = bingham(n,p)

win = bingham window
n = number of points
p = 0..1 (default 0.2)
p = 0 -> rectangular window
p = 1 -> hanning window

## CROSS-REFERENCE INFORMATION

This function calls:
This function is called by:
 dat2spec Estimate one-sided spectral density from data. hanning returns the N-point Hanning window in a column vector.

## SOURCE CODE

```01 function w = bingham(n,p)
02 % BINGHAM  returns the N-point Bingham window in a column vector.
03 %
04 %  CALL: win = bingham(n,p)
05 %
06 %    win = bingham window
07 %      n = number of points
08 %      p = 0..1 (default 0.2)
09 %         p = 0 -> rectangular window
10 %         p = 1 -> hanning window
11 %
13
14 % Tested on: matlab 5.3
15 % History:
16 %  by Per Andreas Brodtkorb%    16.12.1997
17
18 if (nargin < 2)
19  p=0.2;
20 end
21 if (p>1 | p<0)
22   disp('Error: P must be between 0 and 1!')
23   return
24 end
25 n1=floor(p/2*n);
26 n2=n-2*n1;
27 w1 = .5*(1 - cos(2*pi*(1:n1)/(p*(n+1))));
28 w=[w1 ones(1,n2) w1(n1:-1:1) ]';
29```

Mathematical Statistics
Centre for Mathematical Sciences
Lund University with Lund Institute of Technology

Comments or corrections to the WAFO group

Generated on Thu 06-Oct-2005 02:21:16 for WAFO by m2html © 2003