Abstract:
A method of providing an indication of the direction of a target such as a sniper. A rifle mounted sensor array detects an acoustic pulse originating from the target. The signal is processed to estimate the direction of the target, and an indication is provided when the weapon is aligned with the estimated direction. The direction of arrival of an acoustic pulse is estimated by spectrally decomposing each signal from the sensor so as to generate one or more spectral components for each signal, and processing the spectral components to estimate the direction of arrival.

Description:
FIELD OF THE INVENTION 
   The present invention relates in a first aspect to a method and apparatus for providing an indication of the direction of a target, and in a second aspect to a method and apparatus for estimating the direction of arrival of an acoustic pulse. Both aspects may be employed typically, although not exclusively, in a system for identifying the direction and/or range of a sniper and/or determining the trajectory of a bullet fired by the sniper. 
   BACKGROUND OF THE INVENTION 
   U.S. Pat. No. 6,178,141 describes a system for determining the trajectory of a supersonic bullet by observing the shock wave from the bullet. Muzzle blast observations may also be used to estimate the exact sniper location along the trajectory. The sensors are helmet-mounted, and each helmet is supported by wireless communications, GPS and a backpack or otherwise mounted computer system that computes and displays the solutions. 
   SUMMARY OF THE INVENTION 
   A first aspect of the invention provides a method of providing an indication of the direction of a target, the method comprising the steps of detecting a signal originating from the target; processing the signal to estimate the direction of the target relative to a weapon; and providing an indication when the weapon is aligned with the estimated direction of the target. 
   The first aspect of the invention also provides apparatus for providing an indication of the direction of a target, the apparatus comprising a sensor for detecting a signal originating from the target; a processor for processing the signal to estimate the direction of the target relative to a weapon; and a direction indicator for providing an indication when the weapon is aligned with the estimated direction of the target. 
   The first aspect of the invention presents a new method and apparatus for presenting target direction information to a user. By providing a user with an indication when a weapon (typically held or controlled by the user) is aligned with the estimated direction of a target such as a sniper, the user can quickly and accurately return fire. 
   Preferably the apparatus comprises an orientation sensor for providing an output indicative of the direction of the weapon, and the direction indicator provides an indication when the output from the orientation sensor indicates that the weapon is aligned with the estimated direction of the target. 
   The signal originating from the target may be a visual signal (such as a visual muzzle flash) but most preferably the signal is an acoustic signal such as a muzzle blast or projectile shock wave. 
   The signal may be detected by helmet-mounted sensors as in U.S. Pat. No. 6,178,141. However in some situations it may be preferable for the user to be operating in a “helmets off” environment. Also, if the sensors are helmet-mounted then a complex system must be provided to estimate the target direction relative to the weapon. Therefore preferably the signal is detected by one or more sensors mounted on the weapon. 
   Preferably the indication is also provided by an indicator mounted on the weapon. 
   Preferably the sensor, indicator and processor are mounted in a common housing. 
   In a preferred embodiment an indication is provided when the weapon is aligned with a vertical and/or horizontal plane containing the estimated target direction. 
   The indication may be visual or audible. In a preferred example the colour of a visual indicator is changed when the weapon is aligned with the estimated direction of the target. 
   The signal is typically detected by a plurality of sensors which may be arranged in a planar array, or in a volumetric array. Preferably the spacing (or baseline) between the sensors is small, in order to reduce the size of the apparatus. Small spacing does however make it difficult to accurately estimate the target direction. Therefore preferably one of the following methods is used to address this problem:
         i. using a conventional time-of-arrival method in which a threshold crossing point is detected for each sensor. In this case the sampling frequency can be increased to take account of the reduced sensor baseline; or   ii. cross-correlating one or more pairs of sensor signals in the time domain so as to generate one or more cross-correlation signals which are then used in the target direction estimation; or   iii. spectrally decomposing each sensor signal so as to generate one or more spectral components for each signal which are then used in the target direction estimation.       

   Method iii) is preferred, and is discussed in further detail below with reference to the second aspect of the invention. 
   The weapon may be a tank or helicopter, but preferably the weapon is a hand-held weapon such as a rifle. 
   Preferably the (or each) sensor is mounted on the sight of the weapon. This automatically aligns the sensors with the sight and enables more accurate targeting. 
   The direction and/or range indicators may also be mounted on the sight to provide a compact integrated system. 
   In U.S. Pat. No. 6,278,141, fine resolution time difference of arrivals, for the shock wave arrivals, are determined via cross-correlation between the channels. The data are interpolated eight times during the cross-correlation process. 
   A second aspect of the invention provides a method of estimating the direction of arrival of an acoustic pulse, the method comprising:
         a. detecting the pulse with a plurality of sensors so as to generate a plurality of sensor signals;   b. spectrally decomposing each sensor signal so as to generate one or more spectral components for each signal; and   c. processing the spectral components to estimate the direction of arrival of the acoustic pulse.       

   The second aspect of the invention also provides apparatus for detecting the direction of arrival of an acoustic pulse by the above method, the apparatus comprising an array of sensors; and a processor programmed to perform steps b and c. 
   The second aspect of the invention provides a processing method which enables the sensor signals to be sampled at a low rate (which may be as low as the Nyquist rate), whilst maintaining an accurate estimate. Spectrally decomposing the sensor signal reduces the effects of noise, compared with a conventional time-of-arrival method in which a threshold crossing point is detected for each sensor. The second aspect of the invention is particularly suited to use in a volumetric sensor with a small baseline. 
   In one example of the second aspect of the invention, the direction of arrival is calculated by performing a power versus bearing scan. This provides improved accuracy through “bearing coherent” averaging of noise. However for some applications this method may be overcomplicated. Therefore in a preferred embodiment the pulse is detected with a volumetric array of three or more pairs of sensors in step a. so as to generate three or more pairs of sensor signals; a plurality of pairs of spectral components are generated for each pair of sensor signals in step b; and step c. includes calculating a phase delay between each pair of spectral components, and determining the direction of arrival of the acoustic pulse in accordance with the calculated phase delays. The preferred embodiment is computationally simpler than a power versus bearing scan, and also provides improved accuracy through “bearing coherent” averaging of noise. 
   The method may be used in any suitable application, but in preferred examples it is used to estimate the direction of a target and/or to estimate the trajectory of a projectile. 

   
     BRIEF DESCRIPTION OF THE DRAWINGS 
     Various embodiments of the present invention will now be described with reference to the accompanying drawings, in which: 
       FIG. 1  is a perspective view of part of a rifle incorporating an acoustic sensor device; 
       FIG. 2  is an exploded view of the acoustic sensor device, with some parts omitted; 
       FIG. 3  is a schematic view of the components of the acoustic sensor device; 
       FIG. 3   a  is a schematic view of the rifle in combination with a PDA and communication device; 
       FIG. 3   b  is a schematic view of the components of a second acoustic sensor device; 
       FIG. 4  is a schematic view of a bullet trajectory, as viewed in a plane containing the trajectory and receiver; 
       FIG. 5  is a graph showing a pulse waveform x n , a pulse y n  with uniform noise spread over the bandwidth of the pulse, and a spectral analysis window function, all used in a simulation of method a; 
       FIG. 6  is a graph showing spectra for the pulse and noise used in the simulation of method a; 
       FIG. 7  is a graph shows a pulse waveform, noise waveform, and threshold level used in the simulation of method a; 
       FIG. 8  is a graph showing bearing errors calculated in the simulation of method a; 
       FIG. 9  is a graph shows a pulse waveform and noise waveform used in the simulation of method b; 
       FIG. 10  is a graph showing bearing errors calculated in the simulation of method b; 
       FIG. 11  is a graph shows a pulse waveform and noise waveform used in the simulation of method c; 
       FIG. 12  is a graph showing pulse waveforms from two sensors c 0  and c 2 ; 
       FIG. 13  is a graph showing bulk delays for microphone pairs c 20  and c 31 ; and 
       FIG. 14  is a graph showing bearing errors calculated in the simulation of method c. 
   

   DETAILED DESCRIPTION OF EMBODIMENTS 
     FIG. 1  shows a rifle  1  with a sight  2 , and an acoustic sensor device  3 . The device  3  is shown in further detail in  FIG. 2 . The device  3  has a pair of mounting legs  4  which are screwed in place onto the sight  3  and a housing comprising upper and lower hemispheres  5 , 6 . A digital range display  7  is mounted on the lower hemisphere  5 , in this case showing a range of 800 m. A support plate  8  is screwed onto the lower hemisphere  5 . Three light emitting diodes (LEDs)  9  are mounted in the lower hemisphere  5  and one in the upper hemisphere  6   
     FIG. 3  is a schematic view showing various component parts of the device  3 , some of which are omitted from  FIG. 1  for clarity. A volumetric array  20  of six miniature microphones is mounted to the support plate  8 . The microphones are arranged in orthogonal positions around a sphere, with a diameter of between about 4 and 6 cm. The microphones are digitally sampled by an analogue to digital converter  21  and processed by an embedded digital signal processor (DSP)  22 . A pseudo-omni output is formed for automatic detection of impulsive noise. The relative phases of all six microphones are then used to estimate the 3-dimensional direction of arrival of the detected sound. Systematic errors associated with the construction or mounting of the device (e.g. due to resonance, coupling or shading) can be precalibrated. Adaptive processing can be used to reject noise and interference. 
   The DSP  22  controls the LEDs  9 , and range display  7 , and also outputs data to a Bluetooth antenna or other wireless data link. 
   As shown in  FIG. 3   a , the Bluetooth antenna communicates with a personal digital assistant (PDA)  23  which is carried by the soldier. The PDA  23  also receives GPS data  24 , and displays range and direction information in a map-based format. The PDA  23  is connected to a radio communication device  25  via an RS232 link. 
   The DSP  22  estimates the direction of the muzzle blast pulse, and the direction of the shock wave pulse. The range is then estimated by the DSP  22  using the method illustrated in  FIG. 4 . The shot is fired from the left hand corner, and is detected at the right hand corner. The muzzle blast travels directly between the target and the receiver. The shock wave from the passing bullet arrives from a different angle. By measuring the included angle, and the time delay between the two events, and making assumptions about the speed and deceleration of the bullet, a range estimate can be computed. 
     FIG. 3B  is a schematic view of the components of an alternative acoustic sensor device. The device is similar to the device of  FIG. 3   a  but includes an orientation sensor  23 . The orientation sensor  23  contains an inclinometer (which measures the elevation angle of the device relative to the gravity vector) and a compass (which measures the azimuth angle of the device relative to the earth&#39;s magnetic field vector). Thus the sensor  23  provides an output indicative of the sensor&#39;s direction in space. The device of  FIG. 3B  operates as follows:
         1. The sensor array  20  outputs an estimated range and direction of a target to the DSP  22 ;   2. The range display outputs the estimated range;   3. The orientation sensor  23  senses the current orientation of the device, and outputs to the DSP;   4. As the rifle is re-oriented, the DSP compares the estimated direction of the target with the current orientation of the device;   5. If the device is aligned with a horizontal plane containing the estimated target direction, then the two LEDs  9  on the left and right-hand side of the range display shown in  FIG. 2  change from red to green;   6. If the device is aligned with a vertical plane containing the estimated target direction, then the two LEDs  9  above and below the range display shown in  FIG. 2  change from red to green.       
   The comparison in step  4  remains valid whilst the translational position in space of the device is close to the position where the sensor array  20  measured the range and direction. This enables the device to give an immediate detection and localization of a target such as a sniper (for example to a particular window or building) after which usual tactics would apply. 
   The networked system shown in  FIG. 3   a  enables the device to be coupled with GPS data  24  which can be used to fix the translational position of the device, and thus update the estimated range and direction of the target as the device is translated. 
   Extraction of the direction of the target involves two essential steps: (i) measure the propagation delay across the array, and (ii) infer the direction of arrival. 
   A feature of the sensor array is that it includes three orthogonal axes each with two microphones. 
   Therefore, direction can simply be extracted by computing the time delay component along each axis, and resolving them to form a direction vector. This direct form of direction estimation is simpler than say a full maximum-likelihood power vs bearing scan of the array, with almost as good results for high SNR pulses. 
   The preferred method of calculating direction will now be contrasted with other methods which may also be performed by the DSP  22 . Three candidate methods are considered in detail:
         a) Measure the time of arrival of the pulse at each microphone using a threshold crossing technique. Form the direction vector from the three component delays.   b) Cross-correlate each pair of microphones in the time domain, to estimate the delay based on the whole pulse shape. Form the direction vector from the three component delays.   c) The preferred method: decompose the pulse into its spectral components; compute the phase delay for each component along each axis; hence create a direction spectrum (ie. power-weighted direction vector vs frequency); and sum the weighted direction vectors, to obtain the overall direction vector.       

   The relative advantages and disadvantages of each technique are discussed below. 
   Method ‘a’ 
   The array is small in terms of wavelengths (less than two wavelengths across) which means that if using a direct time-domain measurement method the signals must be sampled at a much higher rate (e.g. 400 kHz vs 20 kHz). This will increase power drain and increase the size of the electronics. 
   Method ‘b’ 
   The use of correlation-based time measurement means that the necessary high sample rate can be obtained post-correlation, by interpolation. Method ‘b’ also has the advantage over method ‘a’ that using the whole pulse shape provides averaging of the effects of noise, whereas using a threshold-crossing method yields just one time sample per event. However, for sensible length interpolation filters the basic sample rate would have to exceed the Nyquist rate by a factor. 
   Method ‘c’ 
   Method ‘c’ retains the advantage of method ‘b’ by using the whole pulse shape, but avoids the need to interpolate the correlation output to a very high effective sample rate, so allowing sampling at the Nyquist rate. The phase domain method also provides slightly improved accuracy through ‘bearing coherent’ averaging of noise, rather than just temporal averaging of noise. 
   Some more explanation of method c. will now be given. An alternative method of using phase in the direction estimation (employing a power vs bearing scan) will also be described. 
   The signal vector, across all six microphones, for a signal at elevation θ and azimuth θ is as follows: 
   
     
       
         
           
             s 
             ⁡ 
             
               ( 
               
                 θ 
                 , 
                 ψ 
                 , 
                 λ 
               
               ) 
             
           
           = 
           
             ( 
             
               
                 
                   
                     ⅇ 
                     
                       j 
                       · 
                       2 
                       · 
                       π 
                       · 
                       
                         r 
                         λ 
                       
                       · 
                       
                         cos 
                         ⁡ 
                         
                           ( 
                           ψ 
                           ) 
                         
                       
                       · 
                       
                         cos 
                         ⁡ 
                         
                           ( 
                           θ 
                           ) 
                         
                       
                     
                   
                 
               
               
                 
                   
                     ⅇ 
                     
                       j 
                       · 
                       2 
                       · 
                       π 
                       · 
                       
                         r 
                         λ 
                       
                       · 
                       
                         sin 
                         ⁡ 
                         
                           ( 
                           ψ 
                           ) 
                         
                       
                       · 
                       
                         cos 
                         ⁢ 
                         
                           ( 
                           θ 
                           ) 
                         
                       
                     
                   
                 
               
               
                 
                   
                     ⅇ 
                     
                       
                         - 
                         j 
                       
                       · 
                       2 
                       · 
                       π 
                       · 
                       
                         r 
                         λ 
                       
                       · 
                       
                         cos 
                         ⁡ 
                         
                           ( 
                           ψ 
                           ) 
                         
                       
                       · 
                       
                         cos 
                         ⁢ 
                         
                           ( 
                           θ 
                           ) 
                         
                       
                     
                   
                 
               
               
                 
                   
                     ⅇ 
                     
                       
                         - 
                         j 
                       
                       · 
                       2 
                       · 
                       π 
                       · 
                       
                         r 
                         λ 
                       
                       · 
                       
                         sin 
                         ⁡ 
                         
                           ( 
                           ψ 
                           ) 
                         
                       
                       · 
                       
                         cos 
                         ⁢ 
                         
                           ( 
                           θ 
                           ) 
                         
                       
                     
                   
                 
               
               
                 
                   
                     ⅇ 
                     
                       j 
                       · 
                       2 
                       · 
                       π 
                       · 
                       
                         r 
                         λ 
                       
                       · 
                       
                         cos 
                         ⁡ 
                         
                           ( 
                           θ 
                           ) 
                         
                       
                     
                   
                 
               
               
                 
                   
                     ⅇ 
                     
                       
                         - 
                         j 
                       
                       · 
                       2 
                       · 
                       π 
                       · 
                       
                         r 
                         λ 
                       
                       · 
                       
                         cos 
                         ⁡ 
                         
                           ( 
                           θ 
                           ) 
                         
                       
                     
                   
                 
               
             
             ) 
           
         
       
     
   
   So the received signal, at true direction (θ 0 ψ 0 ), in the presence of noise, is 
   
     
       
         
           
             x 
             ⁡ 
             
               ( 
               λ 
               ) 
             
           
           = 
           
             
               s 
               ⁡ 
               
                 ( 
                 
                   
                     θ 
                     o 
                   
                   , 
                   
                     ψ 
                     o 
                   
                   , 
                   λ 
                 
                 ) 
               
             
             + 
             
               ( 
               
                 
                   
                     
                       n 
                       0 
                     
                   
                 
                 
                   
                     
                       n 
                       1 
                     
                   
                 
                 
                   
                     
                       n 
                       2 
                     
                   
                 
                 
                   
                     
                       n 
                       3 
                     
                   
                 
                 
                   
                     
                       n 
                       4 
                     
                   
                 
                 
                   
                     
                       n 
                       5 
                     
                   
                 
               
               ) 
             
           
         
       
     
   
   The optimal method of estimating the signal direction, assuming uncorrelated background noise would be to do a power vs bearing scan. ie. for beamweights w given by:
 
 w (θ,ψ,λ)=(    s (θ,ψ,λ) ) T  
 
we find the θ and ψ that maximise the following expression
 
 P=w·X·  w     T  
 
where
 
 X=x (λ)·    x (λ)   T  
 
   However this is overcomplicated for the preferred application. 
   Let us consider a modified signal vector, in which opposite microphones along each axis are cross-correlated (or equivalently, the complex frequency-domain signals are multiplied in conjugate). 
   E.g. taking microphones  0  and  2  we have our correlated x-axis sensor: 
   
     
       
         
           
             
               
                 
                   a 
                   x 
                 
                 = 
                 
                   
                     s 
                     0 
                   
                   · 
                   
                     
                       s 
                       2 
                     
                     _ 
                   
                 
               
             
           
           
             
               
                 = 
                 
                   
                     ⅇ 
                     
                       j 
                       · 
                       2 
                       · 
                       π 
                       · 
                       
                         r 
                         λ 
                       
                       · 
                       
                         cos 
                         ⁡ 
                         
                           ( 
                           ψ 
                           ) 
                         
                       
                       · 
                       
                         cos 
                         ⁡ 
                         
                           ( 
                           θ 
                           ) 
                         
                       
                     
                   
                   · 
                   
                     
                       ⅇ 
                       
                         
                           - 
                           j 
                         
                         · 
                         2 
                         · 
                         π 
                         · 
                         
                           r 
                           λ 
                         
                         · 
                         
                           cos 
                           ⁢ 
                           
                             ( 
                             ψ 
                             ) 
                           
                         
                         · 
                         
                           cos 
                           ⁢ 
                           
                             ( 
                             θ 
                             ) 
                           
                         
                       
                     
                     _ 
                   
                 
               
             
           
           
             
               
                 = 
                 
                   ⅇ 
                   
                     j 
                     · 
                     4 
                     · 
                     π 
                     · 
                     
                       r 
                       λ 
                     
                     · 
                     
                       cos 
                       ⁡ 
                       
                         ( 
                         ψ 
                         ) 
                       
                     
                     · 
                     
                       cos 
                       ⁡ 
                       
                         ( 
                         θ 
                         ) 
                       
                     
                   
                 
               
             
           
         
       
     
     
       
         Therefore 
       
     
     
       
         
           
             a 
             ⁡ 
             
               ( 
               
                 θ 
                 , 
                 ψ 
                 , 
                 λ 
               
               ) 
             
           
           = 
           
             ⅇ 
             
               j 
               · 
               
                 ϕ 
                 ⁡ 
                 
                   ( 
                   
                     θ 
                     , 
                     ψ 
                     , 
                     λ 
                   
                   ) 
                 
               
             
           
         
       
     
     
       
         where 
       
     
     
       
         
           
             ϕ 
             ⁡ 
             
               ( 
               
                 θ 
                 , 
                 ψ 
                 , 
                 λ 
               
               ) 
             
           
           = 
           
             ( 
             
               
                 
                   
                     4 
                     · 
                     π 
                     · 
                     
                       r 
                       λ 
                     
                     · 
                     
                       cos 
                       ⁡ 
                       
                         ( 
                         ψ 
                         ) 
                       
                     
                     · 
                     
                       cos 
                       ⁡ 
                       
                         ( 
                         θ 
                         ) 
                       
                     
                   
                 
               
               
                 
                   
                     4 
                     · 
                     π 
                     · 
                     
                       r 
                       λ 
                     
                     · 
                     
                       sin 
                       ⁡ 
                       
                         ( 
                         ψ 
                         ) 
                       
                     
                     · 
                     
                       cos 
                       ⁡ 
                       
                         ( 
                         θ 
                         ) 
                       
                     
                   
                 
               
               
                 
                   
                     4 
                     · 
                     π 
                     · 
                     
                       r 
                       λ 
                     
                     · 
                     
                       cos 
                       ⁡ 
                       
                         ( 
                         θ 
                         ) 
                       
                     
                   
                 
               
             
             ) 
           
         
       
     
   
   But the direction vector of the true signal (in x y z coordinates) is as follows: 
   
     
       
         
           
             d 
             ⁡ 
             
               ( 
               
                 θ 
                 , 
                 ψ 
               
               ) 
             
           
           = 
           
             ( 
             
               
                 
                   
                     cos 
                     ⁢ 
                     
                       
                         ( 
                         ψ 
                         ) 
                       
                       · 
                       
                         cos 
                         ⁡ 
                         
                           ( 
                           θ 
                           ) 
                         
                       
                     
                   
                 
               
               
                 
                   
                     sin 
                     ⁢ 
                     
                       
                         ( 
                         ψ 
                         ) 
                       
                       · 
                       
                         cos 
                         ⁡ 
                         
                           ( 
                           θ 
                           ) 
                         
                       
                     
                   
                 
               
               
                 
                   
                     cos 
                     ⁡ 
                     
                       ( 
                       θ 
                       ) 
                     
                   
                 
               
             
             ) 
           
         
       
     
   
   Therefore we see the following relationship, from which signal direction is obtained directly: 
   
     
       
         
           
             ϕ 
             ⁡ 
             
               ( 
               
                 θ 
                 , 
                 ψ 
                 , 
                 λ 
               
               ) 
             
           
           = 
           
             4 
             · 
             π 
             · 
             
               r 
               λ 
             
             · 
             
               d 
               ⁡ 
               
                 ( 
                 
                   θ 
                   , 
                   ψ 
                 
                 ) 
               
             
           
         
       
     
   
   Therefore, in words, the phase of the cross-correlated microphone pairs, directly yields the signal direction vector, to within a frequency-dependent scale factor. Therefore by analysing the phase of the received pulse, we can estimate the bearing of each spectral component. We can then produce an overall bearing estimate from the power-weighted sum of the component direction vectors. This is not quite optimal (compared to a power bearing scan) but is simpler. Also it does not require any of the microphones to be matched in gain, and only requires them to be phase-matched in pairs, which simplifies construction or calibration of the array. 
   Example Calculations 
                                           Maximum frequency   fmax := 10000       Hz       Speed of sound in air   c := 344       m/s       Acoustic radius of array   r := 0.025       m               Acoustic wavelength           λmin   :=     c     f   ⁢           ⁢   max               λmin = 0.0344   m               Acoustic diameter in wavelengths               2   ·   r       λ   ⁢           ⁢   max       =   1.4535                       Time delay across array           τ   :=       2   ·   r     c             τ · 10 6  = 145.35   μs               Time delay for 1 degree bearing             τ   1     :=       τ   ·   sin     ⁢           ⁢     (     1   ·     π   180       )               τ 1  · 10 6  = 2.536687   μs               Sample rate for Nyquist sampling   fs Nyq  := 2 · fmax   fs Nyq  · 10 −3  = 20   kHz               Sample rate to resolve 1 degree change             fs     1   ⁢           ⁢   deg       :=     1     τ   1               fs 1deg  · 10 −3  = 394.21   kHz                    
Three Algorithms Compared
 
   The three algorithms are compared using a simple simulation. 
   A band-limited pulse is constructed. 
   An uncorrelated noise background is obtained by phase-randomising band-limited pulses, to ensure simulation consistency regardless of sample rate. 
   The scenario is run 100 times, with a different true pulse bearing each time, and the resulting accuracy is compared for the three methods. 
   Sample rates and data collection block lengths for the three methods: 
   
     
       
         
           
             T 
             block 
           
           := 
           
             16 
             
               f 
               ⁢ 
               
                   
               
               ⁢ 
               max 
             
           
         
       
     
     
       
         
           
             
               T 
               block 
             
             · 
             
               10 
               3 
             
           
           = 
           1.6 
         
       
     
     
       
         
           
             fs 
             a 
           
           := 
           
             
               32 
               · 
               f 
             
             ⁢ 
             
                 
             
             ⁢ 
             max 
           
         
       
     
     
       
         
           
             fs 
             b 
           
           := 
           
             
               4 
               · 
               f 
             
             ⁢ 
             
                 
             
             ⁢ 
             max 
           
         
       
     
     
       
         
           
             fs 
             c 
           
           := 
           
             
               2 
               · 
               f 
             
             ⁢ 
             
                 
             
             ⁢ 
             max 
           
         
       
     
     
       
         
           
             
               fs 
               a 
             
             · 
             
               10 
               
                 - 
                 3 
               
             
           
           = 
           320 
         
       
     
     
       
         
           
             
               fs 
               b 
             
             · 
             
               10 
               
                 - 
                 3 
               
             
           
           = 
           40 
         
       
     
     
       
         
           
             
               fs 
               c 
             
             · 
             
               10 
               
                 - 
                 3 
               
             
           
           = 
           20 
         
       
     
     
       
         
           
             N 
             a 
           
           := 
           
             round 
             ⁡ 
             
               ( 
               
                 
                   T 
                   block 
                 
                 · 
                 
                   fs 
                   a 
                 
               
               ) 
             
           
         
       
     
     
       
         
           
             N 
             b 
           
           := 
           
             round 
             ⁡ 
             
               ( 
               
                 
                   T 
                   block 
                 
                 · 
                 
                   fs 
                   b 
                 
               
               ) 
             
           
         
       
     
     
       
         
           
             N 
             c 
           
           := 
           
             round 
             ⁡ 
             
               ( 
               
                 
                   T 
                   block 
                 
                 · 
                 
                   fs 
                   c 
                 
               
               ) 
             
           
         
       
     
     
       
         
           
             N 
             a 
           
           = 
           512 
         
       
     
     
       
         
           
             N 
             b 
           
           = 
           64 
         
       
     
     
       
         
           
             N 
             c 
           
           = 
           32 
         
       
     
   
   Nominal pulse, and (approximately) equal energy flat-spectrum pulse used to generate noise. 
   We assume that the pulse is windowed or gated, so as to exclude extraneous noise. 
   
     
       
         
           
             f 
             o 
           
           := 
           
             
               f 
               ⁢ 
               
                   
               
               ⁢ 
               max 
             
             2 
           
         
       
     
     
       
         
           
             sync 
             ⁡ 
             
               ( 
               x 
               ) 
             
           
           ⁢ 
           
               
           
           := 
           
             if 
             ( 
             
               
                 x 
                 = 
                 0 
               
               , 
               1 
               , 
               
                 
                   sin 
                   ⁡ 
                   
                     ( 
                     x 
                     ) 
                   
                 
                 x 
               
             
             ) 
           
         
       
     
     
       
         
           
             win 
             ⁡ 
             
               ( 
               t 
               ) 
             
           
           ⁢ 
           
               
           
           := 
           
             
               sin 
               ⁡ 
               
                 ( 
                 
                   π 
                   · 
                   
                     t 
                     
                       T 
                       block 
                     
                   
                 
                 ) 
               
             
             4 
           
         
       
     
     
       
         
           
             p 
             ⁡ 
             
               ( 
               t 
               ) 
             
           
           ⁢ 
           
               
           
           := 
           
             
               
                 
                   
                     
                       sync 
                       ⁡ 
                       
                         [ 
                         
                           2 
                           · 
                           π 
                           · 
                           
                             
                               
                                   
                               
                               ⁢ 
                               
                                 f 
                                 o 
                               
                             
                             
                               
                                   
                               
                               ⁢ 
                               2 
                             
                           
                           · 
                           
                             ( 
                             
                               t 
                               ⁢ 
                               
                                   
                               
                               - 
                               
                                   
                               
                               ⁢ 
                               
                                 
                                   T 
                                   block 
                                 
                                 
                                   
                                       
                                   
                                   ⁢ 
                                   2 
                                 
                               
                             
                             ) 
                           
                         
                         ] 
                       
                     
                     2 
                   
                   · 
                 
               
             
             
               
                 
                   sin 
                   ⁡ 
                   
                     [ 
                     
                       
                         2 
                         · 
                         π 
                         · 
                         
                           f 
                           
                             
                                 
                             
                             ⁢ 
                             o 
                           
                         
                         · 
                         
                           ( 
                           
                             t 
                             - 
                             
                               
                                 T 
                                 block 
                               
                               
                                 
                                     
                                 
                                 ⁢ 
                                 2 
                               
                             
                           
                           ) 
                         
                       
                       + 
                       
                         π 
                         
                           
                               
                           
                           ⁢ 
                           4 
                         
                       
                     
                     ] 
                   
                 
               
             
           
         
       
     
     
       
         
           
             q 
             ⁡ 
             
               ( 
               t 
               ) 
             
           
           ⁢ 
           
               
           
           := 
           
             
               
                 
                   
                     sync 
                     ⁡ 
                     
                       [ 
                       
                         2 
                         · 
                         π 
                         · 
                         
                           f 
                           o 
                         
                         · 
                         
                           ( 
                           
                             t 
                             ⁢ 
                             
                                 
                             
                             - 
                             
                                 
                             
                             ⁢ 
                             
                               
                                 T 
                                 block 
                               
                               
                                 
                                     
                                 
                                 ⁢ 
                                 2 
                               
                             
                           
                           ) 
                         
                       
                       ] 
                     
                   
                   · 
                 
               
             
             
               
                 
                   cos 
                   ⁡ 
                   
                     [ 
                     
                       2 
                       · 
                       π 
                       · 
                       
                         f 
                         
                           
                               
                           
                           ⁢ 
                           o 
                         
                       
                       · 
                       
                         ( 
                         
                           t 
                           - 
                           
                             
                               T 
                               block 
                             
                             
                               
                                   
                               
                               ⁢ 
                               2 
                             
                           
                         
                         ) 
                       
                     
                     ] 
                   
                 
               
             
           
         
       
     
     
       
         
           n 
           ⁢ 
           
               
           
           := 
           
             
               0 
               ⁢ 
               
                   
               
               ⁢ 
               … 
               ⁢ 
               
                   
               
               ⁢ 
               
                 N 
                 a 
               
             
             - 
             1 
           
         
       
     
     
       
         
           
             x 
             n 
           
           := 
           
             p 
             ⁡ 
             
               ( 
               
                 n 
                 · 
                 
                   1 
                   
                     fs 
                     a 
                   
                 
               
               ) 
             
           
         
       
     
     
       
         
           X 
           ⁢ 
           
               
           
           := 
           
             FFT 
             ⁡ 
             
               ( 
               x 
               ) 
             
           
         
       
     
     
       
         
           
             y 
             n 
           
           := 
           
             q 
             ⁡ 
             
               ( 
               
                 n 
                 · 
                 
                   1 
                   
                     fs 
                     a 
                   
                 
               
               ) 
             
           
         
       
     
     
       
         
           Y 
           ⁢ 
           
               
           
           := 
           
             FFT 
             ⁡ 
             
               ( 
               y 
               ) 
             
           
         
       
     
     
       
         
           
             SNR 
             adjustdB 
           
           ⁢ 
           
               
           
           := 
           
             20 
             · 
             
               log 
               ⁡ 
               
                 ( 
                 
                   
                     stdev 
                     ⁡ 
                     
                       ( 
                       x 
                       ) 
                     
                   
                   
                     stdev 
                     ⁡ 
                     
                       ( 
                       y 
                       ) 
                     
                   
                 
                 ) 
               
             
           
         
       
     
     
       
         
           
             SNR 
             adjustdB 
           
           ⁢ 
           
               
           
           := 
           1.4118 
         
       
     
   
   Common simulation parameters and functions
               :=1000   k:=0 . . . K−1   

   
     
       
         
           
             θ 
             k 
           
           := 
           
             2 
             · 
             π 
             · 
             
               k 
               K 
             
           
         
       
     
       
       SNR dB :=16 
     
  
             getpulse   ⁡     (     N   ,   fs   ,   delay     )       ⁢           :=     |                   for   ⁢           ⁢   n     ∈       0   ⁢           ⁢   …   ⁢           ⁢   N     -   1                   x   n     ←       p   ⁡     (       n   ·     1   fs       -   delay     )       ·     win   ⁡     (       n   N     ·     T   block       )                         x                         getnoise   ⁡     (     N   ,   fs   ,     SNR   dB       )       ⁢           :=     |               ⁢       for   ⁢           ⁢   n     ∈       0   ⁢           ⁢   …   ⁢           ⁢   N     -   1                   |               ⁢       x   n     ←     q   ⁡     (     n   ·     1             ⁢   fs         )                         ⁢       w   n     ←     win   ⁡     (       n   N     ·     T   block       )                                 ⁢     X   ←     CFFT   ⁡     (   x   )                         ⁢     ϕ   ←     runif   ⁡     (     N   ,     -   π     ,   π     )                         ⁢       for   ⁢           ⁢   n     ∈       0   ⁢           ⁢   …   ⁢           ⁢   N     -   1                       ⁢       Y   n     ←            X   n          ·     ⅇ     j   ·     ϕ   n                             ⁢     y   ←       Re   ⁡     (     ICFFT   ⁡     (   Y   )       )       ·     10     -         SNR   dB     -     SNR   adjustdB       20                             ⁢       (     y   ·   w     )     →                     
Method ‘a’
 
   Generate pulses for each of 100 bearings, for 4 microphones (0=north, 1=east, 2=south, 3=west) 
   
     
       
         
           
             pulse 
             
               a 
               ⁢ 
               
                   
               
               ⁢ 
               0 
             
             
               〈 
               k 
               〉 
             
           
           := 
           
             getpulse 
             ( 
             
               
                 N 
                 a 
               
               , 
               
                 fs 
                 a 
               
               , 
               
                 
                   - 
                   
                     r 
                     c 
                   
                 
                 · 
                 
                   cos 
                   ⁡ 
                   
                     ( 
                     
                       θ 
                       k 
                     
                     ) 
                   
                 
               
             
             ) 
           
         
       
     
     
       
         
           
             pulse 
             
               a 
               ⁢ 
               
                   
               
               ⁢ 
               1 
             
             
               〈 
               k 
               〉 
             
           
           := 
           
             getpulse 
             ⁡ 
             
               ( 
               
                 
                   N 
                   a 
                 
                 , 
                 
                   fs 
                   a 
                 
                 , 
                 
                   
                     - 
                     
                       r 
                       c 
                     
                   
                   · 
                   
                     sin 
                     ⁡ 
                     
                       ( 
                       
                         θ 
                         k 
                       
                       ) 
                     
                   
                 
               
               ) 
             
           
         
       
     
     
       
         
           
             pulse 
             
               a 
               ⁢ 
               
                   
               
               ⁢ 
               2 
             
             
               〈 
               k 
               〉 
             
           
           := 
           
             getpulse 
             ⁡ 
             
               ( 
               
                 
                   N 
                   a 
                 
                 , 
                 
                   fs 
                   a 
                 
                 , 
                 
                   
                     r 
                     c 
                   
                   · 
                   
                     cos 
                     ⁡ 
                     
                       ( 
                       
                         θ 
                         k 
                       
                       ) 
                     
                   
                 
               
               ) 
             
           
         
       
     
     
       
         
           
             pulse 
             
               a 
               ⁢ 
               
                   
               
               ⁢ 
               3 
             
             
               〈 
               k 
               〉 
             
           
           := 
           
             getpulse 
             ⁡ 
             
               ( 
               
                 
                   N 
                   a 
                 
                 , 
                 
                   fs 
                   a 
                 
                 , 
                 
                   
                     r 
                     c 
                   
                   · 
                   
                     sin 
                     ⁡ 
                     
                       ( 
                       
                         θ 
                         k 
                       
                       ) 
                     
                   
                 
               
               ) 
             
           
         
       
     
   
   Generate noise waveforms
 
noise a0   &lt;k&gt; :=getnoise(N a ,fs a ,SNR dB )
 
noise a1   &lt;k&gt; :=getnoise(N a ,fs a ,SNR dB )
 
noise a2   &lt;k&gt; :=getnoise(N a ,fs a ,SNR dB )
 
noise a3   &lt;k&gt; :=getnoise(N a ,fs a ,SNR dB )
 
   Pulse detection threshold (say set at 4 sigma wrt noise, or ¼ of the peak, whichever is greater) 
   
     
       
         
           
             Thresh 
             a 
           
           ⁢ 
           
               
           
           := 
           
             max 
             ( 
             
               
                 4 
                 · 
                 
                   stdev 
                   ⁡ 
                   
                     ( 
                     
                       noise 
                       
                         a 
                         ⁢ 
                         
                             
                         
                         ⁢ 
                         0 
                       
                     
                     ) 
                   
                 
               
               , 
               
                 
                   1 
                   4 
                 
                 · 
                 
                   max 
                   ⁡ 
                   
                     ( 
                     
                       pulse 
                       
                         a 
                         ⁢ 
                         
                             
                         
                         ⁢ 
                         0 
                       
                     
                     ) 
                   
                 
               
             
             ) 
           
         
       
     
     
       
         
           
             Thresh 
             a 
           
           = 
           0.2392 
         
       
     
     
       
         
           := 
           
             
               0 
               ⁢ 
               
                   
               
               ⁢ 
               … 
               ⁢ 
               
                   
               
               ⁢ 
               
                 N 
                 a 
               
             
             - 
             1 
           
         
       
     
   
   Compute times of arrival for each pulse 
   
     
       
         
           
             getTOA 
             ⁡ 
             
               ( 
               
                 x 
                 , 
                 T 
               
               ) 
             
           
           := 
           
             | 
             
               
                 
                   
                     n 
                     ← 
                     0 
                   
                 
               
               
                 
                   
                     while 
                     ⁢ 
                     
                         
                     
                     ⁢ 
                     
                       
                         ( 
                         
                           
                             x 
                             n 
                           
                           &lt; 
                           T 
                         
                         ) 
                       
                       · 
                       
                         ( 
                         
                           n 
                           &lt; 
                           
                             
                               N 
                               a 
                             
                             - 
                             1 
                           
                         
                         ) 
                       
                     
                   
                 
               
               
                 
                   
                     n 
                     ← 
                     
                       n 
                       + 
                       1 
                     
                   
                 
               
               
                 
                   n 
                 
               
             
           
         
       
     
     
       
         
           
             TOA 
             
               a 
               ⁢ 
               
                   
               
               ⁢ 
               
                 0 
                 k 
               
             
           
           := 
           
             getTOA 
             ⁡ 
             
               ( 
               
                 
                   
                     pulse 
                     
                       a 
                       ⁢ 
                       
                           
                       
                       ⁢ 
                       0 
                     
                     
                       〈 
                       k 
                       〉 
                     
                   
                   + 
                   
                     noise 
                     
                       a 
                       ⁢ 
                       
                           
                       
                       ⁢ 
                       0 
                     
                     
                       〈 
                       k 
                       〉 
                     
                   
                 
                 , 
                 
                   Thresh 
                   a 
                 
               
               ) 
             
           
         
       
     
     
       
         
           
             TOA 
             
               a 
               ⁢ 
               
                   
               
               ⁢ 
               
                 1 
                 k 
               
             
           
           := 
           
             getTOA 
             ⁡ 
             
               ( 
               
                 
                   
                     pulse 
                     
                       a 
                       ⁢ 
                       
                           
                       
                       ⁢ 
                       1 
                     
                     
                       〈 
                       k 
                       〉 
                     
                   
                   + 
                   
                     noise 
                     
                       a 
                       ⁢ 
                       
                           
                       
                       ⁢ 
                       1 
                     
                     
                       〈 
                       k 
                       〉 
                     
                   
                 
                 , 
                 
                   Thresh 
                   a 
                 
               
               ) 
             
           
         
       
     
     
       
         
           
             TOA 
             
               a 
               ⁢ 
               
                   
               
               ⁢ 
               
                 2 
                 k 
               
             
           
           := 
           
             getTOA 
             ⁡ 
             
               ( 
               
                 
                   
                     pulse 
                     
                       a 
                       ⁢ 
                       
                           
                       
                       ⁢ 
                       2 
                     
                     
                       〈 
                       k 
                       〉 
                     
                   
                   + 
                   
                     noise 
                     
                       a 
                       ⁢ 
                       
                           
                       
                       ⁢ 
                       2 
                     
                     
                       〈 
                       k 
                       〉 
                     
                   
                 
                 , 
                 
                   Thresh 
                   a 
                 
               
               ) 
             
           
         
       
     
     
       
         
           
             TOA 
             
               a 
               ⁢ 
               
                   
               
               ⁢ 
               
                 3 
                 k 
               
             
           
           := 
           
             getTOA 
             ⁡ 
             
               ( 
               
                 
                   
                     pulse 
                     
                       a 
                       ⁢ 
                       
                           
                       
                       ⁢ 
                       3 
                     
                     
                       〈 
                       k 
                       〉 
                     
                   
                   + 
                   
                     noise 
                     
                       a 
                       ⁢ 
                       
                           
                       
                       ⁢ 
                       3 
                     
                     
                       〈 
                       k 
                       〉 
                     
                   
                 
                 , 
                 
                   Thresh 
                   a 
                 
               
               ) 
             
           
         
       
     
   
   Compute bearing error for each pulse
 
θ err   a     k     :=arg [[( TOA   a2     k     −TOA   a0     k   )+ j ·( TOA   a3     k     −TOA   a1     k   )]· e   −j·θ     k   ]
 
Method ‘b’
 
   Generate pulses for each of 100 bearings, for 4 microphones (0=north, 1=east, 2=south, 3=west) 
   
     
       
         
           
             pulse 
             
               b 
               ⁢ 
               
                   
               
               ⁢ 
               0 
             
             
               〈 
               k 
               〉 
             
           
           := 
           
             getpulse 
             ⁡ 
             
               ( 
               
                 
                   N 
                   b 
                 
                 , 
                 
                   fs 
                   b 
                 
                 , 
                 
                   
                     - 
                     
                       r 
                       c 
                     
                   
                   · 
                   
                     cos 
                     ⁡ 
                     
                       ( 
                       
                         θ 
                         k 
                       
                       ) 
                     
                   
                 
               
               ) 
             
           
         
       
     
     
       
         
           
             pulse 
             
               b 
               ⁢ 
               
                   
               
               ⁢ 
               1 
             
             
               〈 
               k 
               〉 
             
           
           := 
           
             getpulse 
             ⁡ 
             
               ( 
               
                 
                   N 
                   b 
                 
                 , 
                 
                   fs 
                   b 
                 
                 , 
                 
                   
                     - 
                     
                       r 
                       c 
                     
                   
                   · 
                   
                     sin 
                     ⁡ 
                     
                       ( 
                       
                         θ 
                         k 
                       
                       ) 
                     
                   
                 
               
               ) 
             
           
         
       
     
     
       
         
           
             pulse 
             
               b 
               ⁢ 
               
                   
               
               ⁢ 
               2 
             
             
               〈 
               k 
               〉 
             
           
           := 
           
             getpulse 
             ⁡ 
             
               ( 
               
                 
                   N 
                   b 
                 
                 , 
                 
                   fs 
                   b 
                 
                 , 
                 
                   
                     r 
                     c 
                   
                   · 
                   
                     cos 
                     ⁡ 
                     
                       ( 
                       
                         θ 
                         k 
                       
                       ) 
                     
                   
                 
               
               ) 
             
           
         
       
     
     
       
         
           
             pulse 
             
               b 
               ⁢ 
               
                   
               
               ⁢ 
               3 
             
             
               〈 
               k 
               〉 
             
           
           := 
           
             getpulse 
             ⁡ 
             
               ( 
               
                 
                   N 
                   b 
                 
                 , 
                 
                   fs 
                   b 
                 
                 , 
                 
                   
                     r 
                     c 
                   
                   · 
                   
                     sin 
                     ⁡ 
                     
                       ( 
                       
                         θ 
                         k 
                       
                       ) 
                     
                   
                 
               
               ) 
             
           
         
       
     
   
   Generate noise waveforms
 
noise b0   &lt;k&gt; :=getnoise(N b ,fs b ,SNR dB )
 
noise b1   &lt;k&gt; :=getnoise(N b ,fs b ,SNR dB )
 
noise b2   &lt;k&gt; :=getnoise(N b ,fs b ,SNR dB )
 
noise b3   &lt;k&gt; :=getnoise(N b ,fs b ,SNR dB )
 
           :=0  . . . N   b −1

   Compute time delays for each axis by circular correlation and interpolation 
   
     
       
         
           
             getDT 
             ⁡ 
             
               ( 
               
                 x 
                 , 
                 y 
               
               ) 
             
           
           ⁢ 
           
               
           
           := 
           
             | 
             
               
                 
                   
                       
                     ⁢ 
                     
                       X 
                       ← 
                       
                         CFFT 
                         ⁡ 
                         
                           ( 
                           x 
                           ) 
                         
                       
                     
                   
                 
               
               
                 
                   
                       
                     ⁢ 
                     
                       Y 
                       ← 
                       
                         CFFT 
                         ⁡ 
                         
                           ( 
                           y 
                           ) 
                         
                       
                     
                   
                 
               
               
                 
                   
                       
                     ⁢ 
                     
                       Z 
                       ← 
                       
                         
                           ( 
                           
                             X 
                             · 
                             
                               Y 
                               _ 
                             
                           
                           ) 
                         
                         → 
                       
                     
                   
                 
               
               
                 
                   
                       
                     ⁢ 
                     
                       
                         for 
                         ⁢ 
                         
                             
                         
                         ⁢ 
                         n 
                       
                       ∈ 
                       
                         
                           0 
                           ⁢ 
                           
                               
                           
                           ⁢ 
                           … 
                           ⁢ 
                           
                               
                           
                           ⁢ 
                           
                             N 
                             a 
                           
                         
                         - 
                         1 
                       
                     
                   
                 
               
               
                 
                   
                       
                     ⁢ 
                     
                       
                         Z 
                         
                           intp 
                           n 
                         
                       
                       ← 
                       0 
                     
                   
                 
               
               
                 
                   
                       
                     ⁢ 
                     
                       
                         for 
                         ⁢ 
                         
                             
                         
                         ⁢ 
                         n 
                       
                       ∈ 
                       
                         
                           1 
                           ⁢ 
                           
                               
                           
                           ⁢ 
                           … 
                           ⁢ 
                           
                               
                           
                           ⁢ 
                           
                             
                               N 
                               b 
                             
                             2 
                           
                         
                         - 
                         1 
                       
                     
                   
                 
               
               
                 
                   
                     | 
                     
                       
                         
                           
                               
                             ⁢ 
                             
                               
                                 Z 
                                 
                                   intp 
                                   n 
                                 
                               
                               ← 
                               
                                 Z 
                                 n 
                               
                             
                           
                         
                       
                       
                         
                           
                             
                               Z 
                               
                                 intp 
                                 
                                   
                                     N 
                                     a 
                                   
                                   - 
                                   n 
                                 
                               
                             
                             ← 
                             
                               Z 
                               
                                 
                                   N 
                                   b 
                                 
                                 - 
                                 n 
                               
                             
                           
                         
                       
                     
                   
                 
               
               
                 
                   
                       
                     ⁢ 
                     
                       
                         z 
                         intp 
                       
                       ← 
                       
                         ICFFT 
                         ⁡ 
                         
                           ( 
                           
                             z 
                             intp 
                           
                           ) 
                         
                       
                     
                   
                 
               
               
                 
                   
                       
                     ⁢ 
                     
                       
                         for 
                         ⁢ 
                         
                             
                         
                         ⁢ 
                         n 
                       
                       ∈ 
                       
                         
                           0 
                           ⁢ 
                           … 
                           ⁢ 
                           
                               
                           
                           ⁢ 
                           
                             N 
                             a 
                           
                         
                         - 
                         1 
                       
                     
                   
                 
               
               
                 
                   
                     | 
                     
                       
                         
                           
                               
                             ⁢ 
                             
                               
                                 sortarray 
                                 
                                   n 
                                   , 
                                   0 
                                 
                               
                               ← 
                               n 
                             
                           
                         
                       
                       
                         
                           
                               
                             ⁢ 
                             
                               
                                 sortarray 
                                 
                                   n 
                                   , 
                                   1 
                                 
                               
                               ← 
                               
                                  
                                 
                                   z 
                                   
                                     intp 
                                     n 
                                   
                                 
                                  
                               
                             
                           
                         
                       
                     
                   
                 
               
               
                 
                   
                       
                     ⁢ 
                     
                       
                         mod 
                         ⁡ 
                         
                           ( 
                           
                             
                               
                                 
                                   csort 
                                   ⁡ 
                                   
                                     ( 
                                     
                                       sortarray 
                                       , 
                                       1 
                                     
                                     ) 
                                   
                                 
                                 
                                   
                                     
                                       N 
                                       a 
                                     
                                     - 
                                     1 
                                   
                                   , 
                                   0 
                                 
                               
                               + 
                               
                                 
                                   N 
                                   a 
                                 
                                 2 
                               
                             
                             , 
                             
                               N 
                               a 
                             
                           
                           ) 
                         
                       
                       - 
                       
                         
                           N 
                           a 
                         
                         2 
                       
                     
                   
                 
               
             
           
         
       
     
     
       
         
           
             DT 
             
               b 
               
                 20 
                 k 
               
             
           
           := 
           
             getDT 
             ⁡ 
             
               ( 
               
                 
                   
                     pulse 
                     
                       b 
                       ⁢ 
                       
                           
                       
                       ⁢ 
                       2 
                     
                     
                       〈 
                       k 
                       〉 
                     
                   
                   + 
                   
                     noise 
                     
                       b 
                       ⁢ 
                       
                           
                       
                       ⁢ 
                       2 
                     
                     
                       〈 
                       k 
                       〉 
                     
                   
                 
                 , 
                 
                   
                     pulse 
                     
                       b 
                       ⁢ 
                       
                           
                       
                       ⁢ 
                       0 
                     
                     
                       〈 
                       k 
                       〉 
                     
                   
                   + 
                   
                     noise 
                     
                       b 
                       ⁢ 
                       
                           
                       
                       ⁢ 
                       0 
                     
                     
                       〈 
                       k 
                       〉 
                     
                   
                 
               
               ) 
             
           
         
       
     
     
       
         
           
             DT 
             
               b 
               
                 31 
                 k 
               
             
           
           := 
           
             getDT 
             ⁡ 
             
               ( 
               
                 
                   
                     pulse 
                     
                       b 
                       ⁢ 
                       
                           
                       
                       ⁢ 
                       3 
                     
                     
                       〈 
                       k 
                       〉 
                     
                   
                   + 
                   
                     noise 
                     
                       b 
                       ⁢ 
                       
                           
                       
                       ⁢ 
                       3 
                     
                     
                       〈 
                       k 
                       〉 
                     
                   
                 
                 , 
                 
                   
                     pulse 
                     
                       b 
                       ⁢ 
                       
                           
                       
                       ⁢ 
                       1 
                     
                     
                       〈 
                       k 
                       〉 
                     
                   
                   + 
                   
                     noise 
                     
                       b 
                       ⁢ 
                       
                           
                       
                       ⁢ 
                       1 
                     
                     
                       〈 
                       k 
                       〉 
                     
                   
                 
               
               ) 
             
           
         
       
     
   
   Compute each bearing error for each pulse 
             θ   ⁢           ⁢     err     b   k         :=     arg   [       (       DT     b   ⁢           ⁢     20   k         +     j   ·     DT     b   ⁢           ⁢     31   k             )     ·     ⅇ       -   j     ·     θ   k           ]           
Method ‘c’
 
   Generate pulses for each of 100 bearings, for 4 microphones (0=north, 1=east, 2=south, 3=west) 
   
     
       
         
           
             pulse 
             
               c 
               ⁢ 
               
                   
               
               ⁢ 
               0 
             
             
               〈 
               k 
               〉 
             
           
           := 
           
             getpulse 
             ⁡ 
             
               ( 
               
                 
                   N 
                   c 
                 
                 , 
                 
                   fs 
                   c 
                 
                 , 
                 
                   
                     - 
                     
                       r 
                       c 
                     
                   
                   · 
                   
                     cos 
                     ⁡ 
                     
                       ( 
                       
                         θ 
                         k 
                       
                       ) 
                     
                   
                 
               
               ) 
             
           
         
       
     
     
       
         
           
             pulse 
             
               c 
               ⁢ 
               
                   
               
               ⁢ 
               1 
             
             
               〈 
               k 
               〉 
             
           
           := 
           
             getpulse 
             ⁡ 
             
               ( 
               
                 
                   N 
                   c 
                 
                 , 
                 
                   fs 
                   c 
                 
                 , 
                 
                   
                     - 
                     
                       r 
                       c 
                     
                   
                   · 
                   
                     sin 
                     ⁡ 
                     
                       ( 
                       
                         θ 
                         k 
                       
                       ) 
                     
                   
                 
               
               ) 
             
           
         
       
     
     
       
         
           
             pulse 
             
               c 
               ⁢ 
               
                   
               
               ⁢ 
               2 
             
             
               〈 
               k 
               〉 
             
           
           := 
           
             getpulse 
             ⁡ 
             
               ( 
               
                 
                   N 
                   c 
                 
                 , 
                 
                   fs 
                   c 
                 
                 , 
                 
                   
                     r 
                     c 
                   
                   · 
                   
                     cos 
                     ⁡ 
                     
                       ( 
                       
                         θ 
                         k 
                       
                       ) 
                     
                   
                 
               
               ) 
             
           
         
       
     
     
       
         
           
             pulse 
             
               c 
               ⁢ 
               
                   
               
               ⁢ 
               3 
             
             
               〈 
               k 
               〉 
             
           
           := 
           
             getpulse 
             ⁡ 
             
               ( 
               
                 
                   N 
                   c 
                 
                 , 
                 
                   fs 
                   c 
                 
                 , 
                 
                   
                     r 
                     c 
                   
                   · 
                   
                     sin 
                     ⁡ 
                     
                       ( 
                       
                         θ 
                         k 
                       
                       ) 
                     
                   
                 
               
               ) 
             
           
         
       
     
   
   Generate noise waveforms
 
noise c0   &lt;k&gt; :=getnoise(N c   ,fs   c ,SNR dB )
 
noise c1   &lt;k&gt; :=getnoise(N c   ,fs   c ,SNR dB )
 
noise c2   &lt;k&gt; :=getnoise(N c   ,fs   c ,SNR dB )
 
noise c3   &lt;k&gt; :=getnoise(N c   ,fs   c ,SNR dB )
 
           :=0  . . . N   c −1

   Compute spectra for each microphone
 
 X   c0   &lt;k&gt; :=FFT(pulse c0   &lt;k&gt; +noise c0   &lt;k&gt; )
 
 X   c1   &lt;k&gt; :=FFT(pulse c1   &lt;k&gt; +noise c1   &lt;k&gt; )
 
 X   c2   &lt;k&gt; :=FFT(pulse c2   &lt;k&gt; +noise c2   &lt;k&gt; )
 
 X   c3   &lt;k&gt; :=FFT(pulse c3   &lt;k&gt; +noise c3   &lt;k&gt; )
 
   Compute bulk delays (by circular correlation, without interpolation) to a resolution of 1 sample (ie. half wavelength max) to eliminate phase ambiguity. 
   
     
       
         
           
             getBulkDT 
             ⁡ 
             
               ( 
               
                 x 
                 , 
                 y 
               
               ) 
             
           
           ⁢ 
           
               
           
           := 
           
             | 
             
               
                 
                   
                       
                     ⁢ 
                     
                       X 
                       ← 
                       
                         CFFT 
                         ⁡ 
                         
                           ( 
                           x 
                           ) 
                         
                       
                     
                   
                 
               
               
                 
                   
                       
                     ⁢ 
                     
                       Y 
                       ← 
                       
                         CFFT 
                         ⁡ 
                         
                           ( 
                           y 
                           ) 
                         
                       
                     
                   
                 
               
               
                 
                   
                       
                     ⁢ 
                     
                       Z 
                       ← 
                       
                         
                           ( 
                           
                             X 
                             · 
                             
                               Y 
                               _ 
                             
                           
                           ) 
                         
                         → 
                       
                     
                   
                 
               
               
                 
                   
                       
                     ⁢ 
                     
                       z 
                       ← 
                       
                         ICFFT 
                         ⁡ 
                         
                           ( 
                           Z 
                           ) 
                         
                       
                     
                   
                 
               
               
                 
                   
                       
                     ⁢ 
                     
                       
                         for 
                         ⁢ 
                         
                             
                         
                         ⁢ 
                         n 
                       
                       ∈ 
                       
                         
                           0 
                           ⁢ 
                           
                               
                           
                           ⁢ 
                           … 
                           ⁢ 
                           
                               
                           
                           ⁢ 
                           
                             N 
                             c 
                           
                         
                         - 
                         1 
                       
                     
                   
                 
               
               
                 
                   
                     | 
                     
                       
                         
                           
                               
                             ⁢ 
                             
                               
                                 sortarray 
                                 
                                   n 
                                   , 
                                   0 
                                 
                               
                               ← 
                               n 
                             
                           
                         
                       
                       
                         
                           
                               
                             ⁢ 
                             
                               
                                 sortarray 
                                 
                                   n 
                                   , 
                                   1 
                                 
                               
                               ← 
                               
                                  
                                 
                                   z 
                                   
                                     
                                         
                                     
                                     n 
                                   
                                 
                                  
                               
                             
                           
                         
                       
                     
                   
                 
               
               
                 
                   
                       
                     ⁢ 
                     
                       
                         mod 
                         ⁡ 
                         
                           ( 
                           
                             
                               
                                 
                                   csort 
                                   ⁡ 
                                   
                                     ( 
                                     
                                       sortarray 
                                       , 
                                       1 
                                     
                                     ) 
                                   
                                 
                                 
                                   
                                     
                                       N 
                                       c 
                                     
                                     - 
                                     1 
                                   
                                   , 
                                   0 
                                 
                               
                               + 
                               
                                 
                                   N 
                                   c 
                                 
                                 2 
                               
                             
                             , 
                             
                               N 
                               c 
                             
                           
                           ) 
                         
                       
                       - 
                       
                         
                           N 
                           c 
                         
                         2 
                       
                     
                   
                 
               
             
           
         
       
     
     
       
         
           
             BulkDT 
             
               c 
               
                 20 
                 k 
               
             
           
           := 
           
             getBulkDT 
             ⁡ 
             
               ( 
               
                 
                   
                     pulse 
                     
                       c 
                       ⁢ 
                       
                           
                       
                       ⁢ 
                       2 
                     
                     
                       〈 
                       k 
                       〉 
                     
                   
                   + 
                   
                     noise 
                     
                       c 
                       ⁢ 
                       
                           
                       
                       ⁢ 
                       2 
                     
                     
                       〈 
                       k 
                       〉 
                     
                   
                 
                 , 
                 
                   
                     pulse 
                     
                       c 
                       ⁢ 
                       
                           
                       
                       ⁢ 
                       0 
                     
                     
                       〈 
                       k 
                       〉 
                     
                   
                   + 
                   
                     noise 
                     
                       c 
                       ⁢ 
                       
                           
                       
                       ⁢ 
                       0 
                     
                     
                       〈 
                       k 
                       〉 
                     
                   
                 
               
               ) 
             
           
         
       
     
     
       
         
           
             BulkDT 
             
               c 
               
                 31 
                 k 
               
             
           
           := 
           
             getBulkDT 
             ⁡ 
             
               ( 
               
                 
                   
                     pulse 
                     
                       c 
                       ⁢ 
                       
                           
                       
                       ⁢ 
                       3 
                     
                     
                       〈 
                       k 
                       〉 
                     
                   
                   + 
                   
                     noise 
                     
                       c 
                       ⁢ 
                       
                           
                       
                       ⁢ 
                       3 
                     
                     
                       〈 
                       k 
                       〉 
                     
                   
                 
                 , 
                 
                   
                     pulse 
                     
                       c 
                       ⁢ 
                       
                           
                       
                       ⁢ 
                       1 
                     
                     
                       〈 
                       k 
                       〉 
                     
                   
                   + 
                   
                     noise 
                     
                       c 
                       ⁢ 
                       
                           
                       
                       ⁢ 
                       1 
                     
                     
                       〈 
                       k 
                       〉 
                     
                   
                 
               
               ) 
             
           
         
       
     
   
   Compute direction vector spectrum, accounting for bulk delay phase ambiguity. 
   Frequency Resolution: 
   
     
       
         
           
             N 
             c 
           
           = 
           32 
         
       
     
     
       
         
           
             δ 
             ⁢ 
             
                 
             
             ⁢ 
             
               f 
               c 
             
           
           := 
           
             
               fs 
               c 
             
             
               N 
               c 
             
           
         
       
     
     
       
         
           
             δ 
             ⁢ 
             
                 
             
             ⁢ 
             
               f 
               c 
             
           
           = 
           625 
         
       
     
     
       
         
           
             
               freq 
               c 
             
             ⁡ 
             
               ( 
               n 
               ) 
             
           
           := 
           
             
               ( 
               
                 
                   mod 
                   ⁡ 
                   
                     ( 
                     
                       
                         n 
                         + 
                         
                           
                             N 
                             c 
                           
                           2 
                         
                       
                       , 
                       
                         N 
                         c 
                       
                     
                     ) 
                   
                 
                 - 
                 
                   
                     N 
                     c 
                   
                   2 
                 
               
               ) 
             
             · 
             
               
                 fs 
                 c 
               
               
                 N 
                 c 
               
             
           
         
       
     
     
       
         
           
             arrgh 
             ⁡ 
             
               ( 
               x 
               ) 
             
           
           := 
           
             if 
             ⁡ 
             
               ( 
               
                 
                   x 
                   = 
                   0 
                 
                 , 
                 
                   0 
                   ⁢ 
                   
                       
                   
                   ⁢ 
                   
                     arg 
                     ⁡ 
                     
                       ( 
                       x 
                       ) 
                     
                   
                 
               
               ) 
             
           
         
       
     
     
       
         
           
             
               
                 getDvecspect 
               
             
             
               
                 
                   ( 
                   
                     
                       
                         
                           
                             X 
                             ⁢ 
                             
                                 
                             
                             ⁢ 
                             0 
                           
                           , 
                           
                             X 
                             ⁢ 
                             
                                 
                             
                             ⁢ 
                             1 
                           
                           , 
                           
                             X 
                             ⁢ 
                             
                                 
                             
                             ⁢ 
                             2 
                           
                           , 
                         
                       
                     
                     
                       
                         
                           
                             X 
                             ⁢ 
                             
                                 
                             
                             ⁢ 
                             3 
                           
                           , 
                           
                             DT 
                             ⁢ 
                             
                                 
                             
                             ⁢ 
                             20 
                           
                           , 
                           
                             DT 
                             ⁢ 
                             
                                 
                             
                             ⁢ 
                             31 
                           
                         
                       
                     
                   
                   ) 
                 
               
             
           
           := 
           
             | 
             
               
                 
                   
                       
                     ⁢ 
                     
                       
                         for 
                         ⁢ 
                         
                             
                         
                         ⁢ 
                         n 
                       
                       ∈ 
                       
                         
                           0 
                           ⁢ 
                           
                               
                           
                           ⁢ 
                           … 
                           ⁢ 
                           
                               
                           
                           ⁢ 
                           
                             
                               N 
                               c 
                             
                             2 
                           
                         
                         - 
                         1 
                       
                     
                   
                 
               
               
                 
                   
                     | 
                     
                       
                         
                           
                               
                             ⁢ 
                             
                               f 
                               ← 
                               
                                 
                                   freq 
                                   c 
                                 
                                 ⁡ 
                                 
                                   ( 
                                   n 
                                   ) 
                                 
                               
                             
                           
                         
                       
                       
                         
                           
                               
                             ⁢ 
                             
                               
                                 z 
                                 ⁢ 
                                 
                                     
                                 
                                 ⁢ 
                                 02 
                               
                               ← 
                               
                                 X 
                                 ⁢ 
                                 
                                     
                                 
                                 ⁢ 
                                 
                                   
                                     0 
                                     n 
                                   
                                   · 
                                   
                                     
                                       X 
                                       ⁢ 
                                       
                                           
                                       
                                       ⁢ 
                                       
                                         2 
                                         n 
                                       
                                     
                                     _ 
                                   
                                 
                               
                             
                           
                         
                       
                       
                         
                           
                               
                             ⁢ 
                             
                               
                                 z 
                                 ⁢ 
                                 
                                     
                                 
                                 ⁢ 
                                 13 
                               
                               ← 
                               
                                 X 
                                 ⁢ 
                                 
                                     
                                 
                                 ⁢ 
                                 
                                   
                                     1 
                                     n 
                                   
                                   · 
                                   
                                     
                                       X 
                                       ⁢ 
                                       
                                           
                                       
                                       ⁢ 
                                       
                                         3 
                                         n 
                                       
                                     
                                     _ 
                                   
                                 
                               
                             
                           
                         
                       
                       
                         
                           
                               
                             ⁢ 
                             
                               
                                 ϕ 
                                 
                                   adj 
                                   ⁢ 
                                   
                                       
                                   
                                   ⁢ 
                                   20 
                                 
                               
                               ← 
                               
                                 
                                   2 
                                   · 
                                   π 
                                   · 
                                   DT 
                                 
                                 ⁢ 
                                 
                                     
                                 
                                 ⁢ 
                                 
                                   20 
                                   · 
                                   
                                     f 
                                     
                                       fs 
                                       c 
                                     
                                   
                                 
                               
                             
                           
                         
                       
                       
                         
                           
                               
                             ⁢ 
                             
                               
                                 ϕ 
                                 
                                   adj 
                                   ⁢ 
                                   
                                       
                                   
                                   ⁢ 
                                   31 
                                 
                               
                               ← 
                               
                                 
                                   2 
                                   · 
                                   π 
                                   · 
                                   DT 
                                 
                                 ⁢ 
                                 
                                     
                                 
                                 ⁢ 
                                 
                                   31 
                                   · 
                                   
                                     f 
                                     
                                       fs 
                                       c 
                                     
                                   
                                 
                               
                             
                           
                         
                       
                       
                         
                           
                               
                             ⁢ 
                             
                               
                                 θ 
                                 
                                   02 
                                   n 
                                 
                               
                               ← 
                               
                                 
                                   arrgh 
                                   ⁡ 
                                   
                                     ( 
                                     
                                       z 
                                       ⁢ 
                                       
                                           
                                       
                                       ⁢ 
                                       
                                         02 
                                         · 
                                         
                                           ⅇ 
                                           
                                             
                                               - 
                                               j 
                                             
                                             · 
                                             
                                               ϕ 
                                               
                                                 adj 
                                                 ⁢ 
                                                 
                                                     
                                                 
                                                 ⁢ 
                                                 20 
                                               
                                             
                                           
                                         
                                       
                                     
                                     ) 
                                   
                                 
                                 + 
                                 
                                   ϕ 
                                   
                                     adj 
                                     ⁢ 
                                     
                                         
                                     
                                     ⁢ 
                                     20 
                                   
                                 
                               
                             
                           
                         
                       
                       
                         
                           
                             
                               θ 
                               
                                 13 
                                 n 
                               
                             
                             ← 
                             
                               
                                 arrgh 
                                 ⁡ 
                                 
                                   ( 
                                   
                                     z 
                                     ⁢ 
                                     
                                         
                                     
                                     ⁢ 
                                     
                                       13 
                                       · 
                                       
                                         ⅇ 
                                         
                                           
                                             - 
                                             j 
                                           
                                           · 
                                           
                                             ϕ 
                                             
                                               adj 
                                               ⁢ 
                                               
                                                   
                                               
                                               ⁢ 
                                               31 
                                             
                                           
                                         
                                       
                                     
                                   
                                   ) 
                                 
                               
                               + 
                               
                                 ϕ 
                                 
                                   adj 
                                   ⁢ 
                                   
                                       
                                   
                                   ⁢ 
                                   31 
                                 
                               
                             
                           
                         
                       
                       
                         
                           
                             
                               m 
                               n 
                             
                             ← 
                             
                               
                                  
                                 
                                   z 
                                   ⁢ 
                                   
                                       
                                   
                                   ⁢ 
                                   
                                     02 
                                     · 
                                     z 
                                   
                                   ⁢ 
                                   
                                       
                                   
                                   ⁢ 
                                   13 
                                 
                                  
                               
                             
                           
                         
                       
                     
                   
                 
               
               
                 
                   
                     
                       for 
                       ⁢ 
                       
                           
                       
                       ⁢ 
                       n 
                     
                     ∈ 
                     
                       
                         0 
                         ⁢ 
                         
                             
                         
                         ⁢ 
                         … 
                         ⁢ 
                         
                             
                         
                         ⁢ 
                         
                           
                             N 
                             c 
                           
                           2 
                         
                       
                       - 
                       1 
                     
                   
                 
               
               
                 
                   
                     
                       Dvec 
                       n 
                     
                     ← 
                     
                       
                         m 
                         n 
                       
                       · 
                       
                         ( 
                         
                           
                             θ 
                             
                               02 
                               n 
                             
                           
                           + 
                           
                             j 
                             · 
                             
                               θ 
                               
                                 13 
                                 n 
                               
                             
                           
                         
                         ) 
                       
                     
                   
                 
               
               
                 
                   Dvec 
                 
               
             
           
         
       
     
     
       
         
           
             Dvec 
             
               〈 
               k 
               〉 
             
           
           := 
           
             getDvecspect 
             ⁡ 
             
               ( 
               
                 
                   X 
                   
                     c 
                     ⁢ 
                     
                         
                     
                     ⁢ 
                     0 
                   
                   
                     〈 
                     k 
                     〉 
                   
                 
                 , 
                 
                   X 
                   
                     c 
                     ⁢ 
                     
                         
                     
                     ⁢ 
                     1 
                   
                   
                     〈 
                     k 
                     〉 
                   
                 
                 , 
                 
                   X 
                   
                     c 
                     ⁢ 
                     
                         
                     
                     ⁢ 
                     2 
                   
                   
                     〈 
                     k 
                     〉 
                   
                 
                 , 
                 
                   X 
                   
                     c 
                     ⁢ 
                     
                         
                     
                     ⁢ 
                     3 
                   
                   
                     〈 
                     k 
                     〉 
                   
                 
                 , 
                 
                   BulkDT 
                   
                     c 
                     ⁢ 
                     
                         
                     
                     ⁢ 
                     
                       20 
                       k 
                     
                   
                 
                 , 
                 
                   BulkDT 
                   
                     c 
                     ⁢ 
                     
                         
                     
                     ⁢ 
                     
                       31 
                       k 
                     
                   
                 
               
               ) 
             
           
         
       
     
   
   Compute weighted sum direction vector 
   
     
       
         
           
             Dvecsum 
             k 
           
           := 
           
             
               ∑ 
               
                 n 
                 = 
                 0 
               
               
                 
                   
                     N 
                     c 
                   
                   2 
                 
                 - 
                 1 
               
             
             ⁢ 
             
               Dvec 
               
                 n 
                 , 
                 k 
               
             
           
         
       
     
   
   Compute bearing error for each pulse 
   
     
       
         
           
             θ 
             ⁢ 
             
                 
             
             ⁢ 
             
               err 
               
                 c 
                 k 
               
             
           
           := 
           
             arg 
             ⁡ 
             
               ( 
               
                 
                   Dvecsum 
                   k 
                 
                 · 
                 
                   ⅇ 
                   
                     
                       - 
                       j 
                     
                     · 
                     
                       θ 
                       k 
                     
                   
                 
               
               ) 
             
           
         
       
     
   
   Now compare the three results: 
   
     
       
         
           
             
               ( 
               
                 
                   
                     
                       stdev 
                       ⁡ 
                       
                         ( 
                         
                           θ 
                           ⁢ 
                           
                               
                           
                           ⁢ 
                           
                             err 
                             a 
                           
                         
                         ) 
                       
                     
                   
                   
                     
                       median 
                       ⁡ 
                       
                         ( 
                         
                           
                              
                             
                               θ 
                               ⁢ 
                               
                                   
                               
                               ⁢ 
                               
                                 err 
                                 a 
                               
                             
                              
                           
                           → 
                         
                         ) 
                       
                     
                   
                   
                     
                       max 
                       ⁡ 
                       
                         ( 
                         
                           
                              
                             
                               θ 
                               ⁢ 
                               
                                   
                               
                               ⁢ 
                               
                                 err 
                                 a 
                               
                             
                              
                           
                           → 
                         
                         ) 
                       
                     
                   
                 
                 
                   
                     
                       stdev 
                       ⁡ 
                       
                         ( 
                         
                           θ 
                           ⁢ 
                           
                               
                           
                           ⁢ 
                           
                             err 
                             b 
                           
                         
                         ) 
                       
                     
                   
                   
                     
                       median 
                       ⁡ 
                       
                         ( 
                         
                           
                              
                             
                               θ 
                               ⁢ 
                               
                                   
                               
                               ⁢ 
                               
                                 err 
                                 b 
                               
                             
                              
                           
                           → 
                         
                         ) 
                       
                     
                   
                   
                     
                       max 
                       ⁡ 
                       
                         ( 
                         
                           
                              
                             
                               θ 
                               ⁢ 
                               
                                   
                               
                               ⁢ 
                               
                                 err 
                                 b 
                               
                             
                              
                           
                           → 
                         
                         ) 
                       
                     
                   
                 
                 
                   
                     
                       stdev 
                       ⁡ 
                       
                         ( 
                         
                           θ 
                           ⁢ 
                           
                               
                           
                           ⁢ 
                           
                             err 
                             c 
                           
                         
                         ) 
                       
                     
                   
                   
                     
                       median 
                       ⁡ 
                       
                         ( 
                         
                           
                              
                             
                               θ 
                               ⁢ 
                               
                                   
                               
                               ⁢ 
                               
                                 err 
                                 c 
                               
                             
                              
                           
                           → 
                         
                         ) 
                       
                     
                   
                   
                     
                       max 
                       ⁡ 
                       
                         ( 
                         
                           
                              
                             
                               θ 
                               ⁢ 
                               
                                   
                               
                               ⁢ 
                               
                                 err 
                                 c 
                               
                             
                              
                           
                           → 
                         
                         ) 
                       
                     
                   
                 
               
               ) 
             
             · 
             
               180 
               π 
             
           
           = 
           
             ( 
             
               
                 
                   0.6928 
                 
                 
                   0.4886 
                 
                 
                   2.2567 
                 
               
               
                 
                   0.5096 
                 
                 
                   0.3562 
                 
                 
                   1.4211 
                 
               
               
                 
                   0.3638 
                 
                 
                   0.2388 
                 
                 
                   1.2215 
                 
               
             
             ) 
           
         
       
     
   
   So typically method c wins, whether compared in terms of standard deviation, median, or maximum error. However, the advantage is not overwhelming, so the main advantage is that we can use a lower sample rate (and hence use less standby power). 
   Note that this analysis does not account for frequency-dependent bearing distortion (e.g. short multipath reception), and so there may be further, possibly more significant, advantages in bearing coherent processing when more complex environments are considered. 
   Although the invention has been described above with reference to one or more preferred embodiments, it will be appreciated that various changes or modifications may be made without departing from the scope of the invention as defined in the appended claims.