# Bachelor thesis EE3842 Bachelor afstudeerproject Indoor Localization using Signals of Opportunity Tuesday 9

EE3842 Bachelor afstudeerproject Bachelor thesis Indoor Localization using Signals of Opportunity Delft University of Technology Tuesday 9th July, 2013 Michael van der Cammen, Ramin Barak, Heming Zhang Acknowledgements Our gratitude goes out to J.A. Martinez Castaneda, TU Delft and Sony. J.A. Martinez Castaneda has provided a lot of support and always shared his knowledge and valuable insights during the course of the project. TU Delft has provided the study area and other supports to the project. Sony has supplied us with multiple smart phones, which enabled us to perform the necessary experiments. 2 Foreword This thesis is a part of the bachelor graduation project of Electrical Engineering. The topic is "Indoor Localization using Signals of Opportunity". Two groups focused on this particular topic, one of which mainly looked at the hardware/software involved and the other at the theoretical derivation of the algorithm. This thesis is concerned with the algorithmical part. 3 Contents 1 Introduction 6 2 Program of Requirements 2.1 Requirements of usage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.2 Requirements of the ecological situation of the system within a particular environment 2.3 Requirements concerning the system design . . . . . . . . . . . . . . . . . . . . . . 2.3.1 Characteristics of usage . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.3.2 Characteristics of the production and installations . . . . . . . . . . . . . . . 2.3.3 Characteristics of liquidation . . . . . . . . . . . . . . . . . . . . . . . . . . 2.4 Requirements of development of the system . . . . . . . . . . . . . . . . . . . . . . 7 7 7 7 7 7 7 7 3 Problem Formulation 8 4 Related Research 4.1 Time Of Arrival . . . . . . 4.2 Time Difference Of Arrival 4.3 Angle of arrival . . . . . . 4.4 ”Fingerprinting” . . . . . . . . . . 10 10 11 13 14 . . . . 15 15 15 15 18 6 Tests and Results 6.1 Results of TDOA . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6.2 Results of Fingerprinting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26 26 28 7 Discussion 33 8 Conclusion 35 9 Future work 36 5 . . . . . . . . . . . . . . . . Design process and proposed solution 5.1 Discussion of previous methods . 5.2 Proposed Algorithm . . . . . . . . 5.2.1 The TDOA Phase . . . . . 5.2.2 The Fingerprinting Phase . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . References 37 Appendix A TDOA 39 Appendix B Fingerprinting 41 4 Summary This thesis proposes an algorithm to solve the issue of indoor localization using a source, reference receiver and mobile receiver placed in a convex room. The goal is determination of the position of the mobile receiver. The proposed algorithm consists of two localization techniques known from scientific literature: Time Difference of Arrival(TDOA) and Fingerprinting. In this work the choice was made to focus on two following kinds of signals: white noise and human speech. The proposed algorithm has been tested by means of various variables and these experiments have led to the following conclusions: the TDOA part of the algorithm strongly depends on the synchronization between the receivers while the Fingerprinting performs in an optimal manner when a white noise signal is being used as a source. The Fingerprinting part of the proposed algorithm contains four different ways to compare between the audio signal of the database and the audio signal of a real world situation. It appears that the cross - correlation in time domain yields the best results. 5 1 Introduction The problem of self determining your location within an indoor environment has been a topic of interest for many years [1, 2, 3, 4]. The localization technology is applicable in many different situations, varying from finding your way in a congress hall to providing assistance to the fire department elements inside a building on fire [5]. Localization itself, however, is not an entirely new concept. Outdoor localization is already possible via technologies like the Global Positioning System (GPS). In this case the satellites simultaneously transmit their position and the current time to a receiver on earth, which uses the received data and the difference of arrival of the signals to derive its location [6]. Unfortunately, the signals produced by the satellites are not reliable in indoor environments due to attenuation during the propagation. This weakening is mainly caused due to the absorption of the satellite signals by most materials [7]. Because of this, outdoor signals can not be blindly used in an indoor environment. Another problem of the indoor localization process is the multipath effect which refers to the signal reflections due to the presence of ceilings, walls and other physical obstacles within indoor environments. All transmitted signals are reflected many times which makes the task of distinguishing the target signal from its reflections rather challenging [1]. Due to the fact that it is not always possible to make use of outdoor sources, this work focuses on making use of sources within a particular indoor situation. The most interesting signals to consider in this case, which are also the signals that are used throughout this work, are the so called "signals of opportunity": signals which are present in a particular environment either due to natural causes (e.g. heat or magnetic waves), or human intervention (e.g. WIFI signals), which are not originally meant for localization purposes. This particular type of signals is highly appealing due to their frequent presence in daily situations and also due to the fact that the localization process can be executed without the need to generate any signals. Many attempts have been made to solve the indoor localization problem by making use of signals of opportunity [8, 9, 10, 11]. In our particular case the decision fell upon using acoustic signals of opportunity, the main reason being the following: a small timing inaccuracy would result into huge deviations in distances in case of using electromagnetic waves due to their much higher speed. The aim of this work is to design a robust and reliable algorithm to deal with the problems caused by the effects of multipath, which is equivalent to reverberation in case of acoustic signals. This work proposes a method to perform indoor localization while making use of the presence of particular acoustic sources. The algorithm in question is a combination of the Fingerprinting and the Time Difference Of Arrival (TDOA) techniques. TDOA will be explained in detail together with Fingerprinting in Sec.4. The implementation of the algorithm will result in an application to be run on the smart-phones provided by Sony. The structure of this thesis is the following. Sec. 2 contain the programme of requirements. In Sec. 3 the problem statement of the research will be defined. Sec. 4 makes a summary of known ways to deal with indoor localization. Sec. 5 contains a detailed analysis of the proposed algorithm. Sec. 6 describes the various simulations and results. In Sec. 7 a discussion of the results is provided as well as possible improvements. Conclusions are drawn in Sec. 8. The last section suggests the possible future work. 6 2 Program of Requirements This thesis proposes a new algorithm to deal with the problem of indoor localization using signals of opportunity. This particular topic has been of many interest to the scientific society for many years, but unfortunately no satisfactory solution has been derived yet. This work tries to add to those many years of research and proposes some interesting ideas. 2.1 Requirements of usage 2.1.1 The algorithm must be able to localize a mobile phone within a convex room. 2.1.2 The algorithm must not make use of any other signals than those of opportunity. 2.1.3 The algorithm must be performed quickly on the mobile phone. 2.2 Requirements of the ecological situation of the system within a particular environment 2.2.1 The algorithm must not transmit the information of the user to other devices. 2.3 2.3.1 Requirements concerning the system design Characteristics of usage 2.3.1.1 The algorithm must be applicable to acoustic signals. 2.3.1.2 The algorithm must be implementable by mobile phones. 2.3.1.3 The algorithm must be performed automatically right after the start. 2.3.2 Characteristics of the production and installations 2.3.2.1 No additional signal source is needed. 2.3.2.2 The placing of the reference receiver must not interfere with the room or building’s casual activities. 2.3.3 Characteristics of liquidation 2.3.3.1 The reference receiver must be easily demountable. 2.3.3.2 The reference receiver must be recyclable. 2.4 Requirements of development of the system 2.4.1 The algorithm will be tested using Matlab. 7 3 Problem Formulation In this section, the mathematical model of the problem in question and the notation used in this thesis are defined first. Consider a convex room where it is assumed that there is always a Line-of-Sight channel between the source and the receivers. The reason for having this Line-of-Sight channel will be explained in Sec. 5. Without loss of generality and for simplicity, the geometry of a room in this work is approximated by a rectangular cuboid, which is the usual shape of a room [12]. The x, y and z axis of the Cartesian coordinate system are defined along the length, width and height direction respectively. Fig. 1 shows the geometry together with the Cartesian coordinate system. For a room with length Lx , width Ly and height Lz , the location of one point within this room is given by the vector p = [x, y, z]T , where 0 < x < Lx , 0 < y < Ly , 0 < z < Lz . Figure 1: Scenario with 1 source, 1 anchor and 1 mobile receiver The study of this work involves an acoustic signal source, a reference receiver (also referred to as an anchor, the case with more anchors will be discussed in Sec. 9), and a mobile receiver distributed around the room. The position of the source is defined as ps = [xs , ys , zs ]T , the position of the anchor is defined as pa = [xa , ya , za ]T , and the position of the mobile receiver is defined as pm = [xm , ym , zm ]T . As described in Sec.1, signals of opportunity are the signals which are present in a particular environment and are originally not meant for localization purposes. Several examples of signals of opportunity are the WIFI signals from access points, the noises generated by all electronic devices and the announcements emanating from the loudspeakers. There are many different signals of opportunity, but all of them share the following property: the pattern of these signals is expected to be unknown in advance. For example, one is not to be expected to have any specific knowledge about what the noise will look like in advance. In this work, the type of the signals used is limited to acoustic signals. The main reason, as already mentioned in Sec.1, is the fact that the acoustic signals propagate much slower than electromagnetic waves. Therefore similar deviations in time measurements will result in less deviation during localization. Besides, the wave length of acoustic signals used is usually longer than that of electromagnetic waves. The reason for this statement will be explained in more detail in Sec.5.2.2. There were many different kinds of acoustic signals of opportunity to choose from, but this work focuses on the two following types: white noise and speech signals. There are two different reasons for this particular prerogative: the two selected signals are usually present in most environments and also appear to suit the implementation represented in this thesis. Both of these reasons will be dealt with in more detail in Sec.5.2.2. 8 The dimension of the room (Lx , Ly , Lz ), the position of the source ps and the location of the anchor pa are given. Since most individuals hold their mobile phone at a similar height, it is assumed that the height of the mobile phone is a known constant. In addition, the anchor is situated at the same height as the mobile phone. This height is being denoted as z0 . Therefore the following is the case, pa = [xa , ya , za ]T ≈ [xa , ya , z0 ]T , pm = [xm , ym , zm ]T ≈ [xm , ym , z0 ]T . (1) Since z0 is an estimation of the height, it introduces a certain inaccuracy. In Sec.5.2.2 it will be shown that this inaccuracy is acceptable. Thus the task is to compute the x, y coordinates of the mobile receiver xm and ym by making use of the given information above. Unlike out in the open, the propagation of waves indoors consists of many different paths due to the effect of reflection. A channel is defined as the set of all the propagation paths from a source to a receiver and is described with its impulse response h. Here a Wide-Sense-Stationary Uncorrelated Scattering(WSSUS) model is being used[13]. In this model, it is assumed that the channel correlation function is invariant over time and that the scatterers with different path delays are uncorrelated. In the discrete version, the impulse response is denoted as h[n], or H[ω] in the frequency domain. Therefore, in the noiseless case, the signal received at the receiver can be written in the time and frequency domains using discrete Fourier transform as, F x[n] = s[n] ∗ h[n] − → X[ω] = S[ω]H[ω], (2) where s[n] and S[ω] are the source signal in time and frequency domain, respectively. Naturally, the noises can not be neglected in a real world scenario. There are several sources which contribute to the noise. One is the signal source which could be considered as a part of the source signals since the signals are unknown in advance. Another are the receivers and is uncorrelated with the source signals and the channel. Some noise might also be introduced during the propagation of the signal due to the changes in temperature, humidity or density of the medium. This particular kind of noise is also uncorrelated with the source signals and the channel. The change of signals due to multi-path effect, diffraction or other effects correlated with the channel is not considered as noise but a part of the channels. Therefore the noise could be split into the following two groups: part of the source signal and addition to the received signal. Taking all of the above mentioned noise into account, the following model arises, F x[n] = s[n] ∗ h[n] + w[n] − → X[ω] = S[ω]H[ω] +W [ω], (3) where w[n] and W [ω] are the noise in time and frequency domain, respectively. In this case it is assumed that the noise is uncorrelated to the source signals and the channel and varies per measurement. A common assumption of noise is white Gaussian noise [14, 15, 16]. In this case, the noise in frequency domain is also white Gaussian noise according to its property. Furthermore, the convolution between sequences X and Y is denoted as X ∗ Y and the crosscorrelation between sequences X and Y is denoted as x ? y. The complex conjugate of x is denoted as x∗ while the expected value of sequence X is denoted as E[X]. The covariance of sequences X and Y is denoted as cov(X,Y ), the standard deviation of a sequence X is denoted as σX and the 2-norm of vector x is given by kxk. The inverse of matrix X is denoted as X−1 while the velocity of the propagation of the sound wave in air is denoted as c.And finally the distance between the source and the anchor is denoted as ds,a , the distance between the source and the mobile receiver is denoted as ds,m and the distance between the anchor and the mobile receiver is denoted as da,m . 9 4 Related Research The concept of indoor localization has intrigued the scientific world throughout the past decades. It is therefore not surprising that many different approaches have been proposed to deal with the problem. In the following subsection a brief analysis is provided of the most prominent localization techniques relevant to this work. 4.1 Time Of Arrival Time Of Arrival (TOA) is the simplest of these techniques. In this case the location of a particular source is being derived by means of a certain amount of receivers at known locations. Let us take a source at an unknown position Ps and a receiver at a known position Pr1 . Let us also denote the time at which the signal is transmitted by the source as Tt and the time at which the signal is received by the receiver as Tr1 . If both of these times are known, the distance between Ps and Pr1 , denoted as Dsr1 , may be derived using the following formula, Dsr1 = c(Tr1 − Tt ), (4) where c denotes the speed at which the signal propagates throughout the space and depends on the source used. Fig. 2 shows an overview of the situation. Figure 2: TOA basic situation However, a single receiver with a known position does not suffice to derive the position of the unknown source. Two receivers with known positions, namely Tr2 and Tr3 , need to be added to the configuration in order to be able to use TOA to estimate the location of the source. Due to the fact that there are three receivers, there are three direct distances between the source and each one of the receivers, namely Dsr1 , Dsr2 and Dsr3 . By making use of the Fig. 3 as well as Pythagoras’ theorem the following equations can be derived, (Dsr1 )2 = (Xs )2 + (Ys )2 , (5) (Dsr2 )2 = (X2 − Xs )2 + (Y2 −Ys )2 , 2 2 2 (Dsr3 ) = (X3 − Xs ) + (Y3 −Ys ) . (6) (7) One way of solving (5), (6) and (7) and enabling the usage of more receivers (in case of inaccuracies or noise) is by means of the linear least-squares solution. This takes place in the following manner. Eq. (5) is extracted from (6) and also from (7) resulting into, (Dsr2 )2 − (Dsr1 )2 = (X2 )2 − 2X2 Xs + (Y2 )2 − 2Y2Ys , 2 2 2 2 (Dsr3 ) − (Dsr1 ) = (X3 ) − 2X3 Xs + (Y3 ) − 2Y3Ys . 10 (8) (9) Figure 3: TOA with three receivers A way of stating (8) and (9) in a matrix form is the following, Hx = b, 1 (X2 )2 + (Y2 )2 − (Dsr2 )2 + (Dsr1 )2 X2 Y2 Xs where H ≡ , x≡ , b≡ . X3 Y3 Ys 2 (X3 )2 + (Y3 )2 − (Dsr3 )2 + (Dsr1 )2 (10) In the case of (10) the linear least - squares solution would look like the following, x̂ = (HT H)−1 HT b. (11) The problem with the time of arrival method is synchronization. The absolute values of Tt , Tr1 , Tr2 and Tr3 are difficult to derive due to different internal timing mechanisms. This timing problem results into inaccuracies during the calculation of Ps . Another obstacle in this case is the fact that while using signals of opportunity as sources, the signal transmission time instant might be completely unknown which makes the above calculations impossible. For more details on this technique the reader is referred to [5, 17, 18]. 4.2 Time Difference Of Arrival Time Difference Of Arrival (TDOA) is a method which makes use of the fact that a particular amount of receivers placed at different distances from a particular source receive the signals produced by the source at different times. Take three different receivers at known positions Pr1 , Pr2 and Pr3 and a single source situated at an unknown position Ps . The whole situation is displayed in Fig. 4. Assume the source transmits a particular signal towards each of the receivers. If the distances between the receivers from the source are denoted as Dr1r2 and Dr1r3 , then the following holds, q p 2 2 2 X +Y + Z − (X − X2 )2 +Y 2 + Z 2 = Tr1r2 c = Dsr1r2 , (12) q p X 2 +Y 2 + Z 2 − (X − X3 )2 + (Y −Y3 )2 + Z 2 = Tr1r3 c = Dsr1r3 , (13) 11 Figure 4: The initial position to derive TDOA comprising three receivers where Tr1r2 is the difference in time it takes for a signal to get from the source to the first receiver and from the source to the second receiver while Tr1r3 represents the difference in time it takes for a signal to get from the source to the first receiver and from the source to the third receiver. c denotes the propagation speed of the signal and depends on the source being used. The interesting part about (12) and (13) is the fact that Dsr1r2 and Dsr1r3 are fixed values which are caused by the fixed nature of Tr1r2 (as long as neither the receivers nor the source are moved) and c. This actually enables us to consider the whole TDOA problem as the construction of hyperboloids. This particular switch is possible due to characteristic of the hyperboloids which states that the difference between the distances from a particular point to the loci of the hyperboloid is fixed. In this case the receivers would represent the loci of the hyperboloid and the source would represent a random point. Rearranging, squaring and simplifying (12) and (13) results into the following, p X 2 +Y 2 + Z 2 , p (Dsr1r3 )2 − a2 + 2X3 X + 2Y3Y = 2Dsr1r3 X 2 +Y 2 + Z 2 , (Dsr1r2 )2 − X22 + 2X2 X = 2Dsr1r2 (14) (15) p where a is equal to (X3 )2 + (Y3 )2 . Squaring (14) and (15) provides us with the equations for two distinct hyperboloids, the loci of one of which are situated at the origin and (X2 , 0, 0) and the other at the origin and (X3 ,Y3 , 0). Naturally, these two hyperboloids will intersect at a curve. However, in order to be able to estimate Ps another hyperboloid is required which would imply the addition of another receiver to the situation. However, it is also possible to turn the situation around: set off with an unknown receiver and four known sources and estimate the location of the receiver. Although the TDOA is a rather attractive technique, there is one challenging problem: the synchronization between the different receivers needs to be extremely accurate to minimize localization errors. For more details the reader is referred to [3, 5, 8, 19, 20, 21, 22]. 12 4.3 Angle of arrival In the Angle of arrival (AOA) sometimes referred to as DOA (Distance of Arrival) technique the angle between the transmitted signal and some direction used as a reference is being derived. Consider a scenario which involves a source located at an unknown position (Xs ,Ys ) and two receivers located at (0, 0) and (Xr2 ,Yr2 ) as is pictured in Fig. 5. Using (5) as a reference the following can be derived for Figure 5: Depiction of a possible AOA scenario the position of the source, Xs Dsr1 cos α1 = , Ys Dsr1 sin α1 Xs Xr2 − Dsr2 cos α2 = . Ys Yr2 + Dsr2 sin α2 (16) (17) Transforming (16) and (17) yields, Hx = b, (18) Xs Dsr1 cos α1 where x stands for and b equals in the first case. In the second case b equals Y Dsr1 sin α1 s Xr2 − Dsr2 cos α2 . Yr2 + Dsr2 sin α2 The solution to the estimation of the source then lies in the linear least-squares methodology and is calculated in the following manner, x̂ = (HT H)−1 HT b. (19) The advantage of this particular technique is the fact that no synchronization for either the source or the receivers is necessary [5]. 13 4.4 ”Fingerprinting” Fingerprinting involves the creation of a database of a particular space which will later serve as a site for indoor localization. The process can be conveyed in the following manner: a particular room, rooms or even an entire building is chosen where the technique of indoor localization will be applied. A particular source producing a signal will be placed within the environment and the room itself will be divided into evenly spaced grid points. Next, measurements of the received signals at each of these grid points will be performed and used to come up with a database of the room in question. This particular database may consist of grid points containing the whole received signal or only particular characteristics of it such as Received Signal Strength (RSS). The big advantage of this particular method is the uniqueness of the contents of each of the grid points enabling one to perform some interesting analysis. The disadvantages of fingerprinting are the large amount of time and effort required to construct the database as well as the spatial dependency. The latter implies the fact that any tiny alterations in the room in question would require a restart of the measurements [1, 23, 24]. Naturally, there are other existing approaches which enable indoor localization but the most of them are not related to this work. 14 5 Design process and proposed solution 5.1 Discussion of previous methods Consider a room as described in Sec.3 Fig.1 containing a source at a known location, a reference receiver at a known position and a mobile receiver at an unknown position. The goal is to determine the position of the mobile receiver. First of all the existing methods from the scientific literature will be discussed. • TOA makes use of the time at which a signal is being transmitted, Tt , as mentioned in Sec.4. Unfortunately, Tt is not known in our case and it is therefore not possible to make use of the TOA technique directly. • The AOA (DOA) method determines the angle of arrival in order to calculate the location of the source. However, this method requires more receivers to determine this angle, which does not match the set up of this paper. • The TDOA technique as described in Sec.4 can be used to determine the position of the mobile receiver in the room pm . Usually each TDOA measurement defines a hyperbola (or hyperboloid in case of 3D) and more than one TDOA measurement is needed to compute the intersection of the hyperbolas (hyperboloids in case of 3D). However, in order to do this, at least two additional sources (at known positions) are needed. Besides, the accuracy of the TDOA method is rather limited in case of an indoor environment. • Fingerprinting is a relatively new method. The concept is to compare the received signal with a database constructed beforehand. This particular method does not try to eliminate the multipath effect but instead tends to make use of it. The most current researches on Fingerprinting comprise the storage of particular characteristics of the signals such as Received Signal Strength ( RSS ) in the database.The problem with this particular technique are its spatial dependency and effort involved in the production of the database. 5.2 Proposed Algorithm The proposed algorithm is inspired by the TDOA and Fingerprinting methods. It is a combination of the TDOA measurements as well as the concept of Fingerprinting. Differences between the suggest technique and the existing methodology are being described in great detail in Sec. 5.2.1 and Sec. 5.2.2. TDOA measurements are employed to reduce the computational complexity and time consumption of the process by obtaining a region where the mobile receiver is located. The Fingerprinting is used for the more accurate localization. A brief block diagram is shown in Fig. 6. During the first phase, the TDOA between the receivers is extracted. Afterwards, the TDOA as well as the positions of the source, the reference receiver and the dimension of the room are used to obtain the possible region of situation of the mobile receiver. During the second phase, the received signals and the signals which make up the database are processed and compared to acquire the position of the mobile receiver. 5.2.1 The TDOA Phase The TDOA Phase consists of two main stages: 1. Extracting the TDOA 15 Figure 6: Block diagram algorithm 2. Determining the region of the target position Stage 1. Extracting the TDOA Consider two signals received by the reference receiver and the mobile receiver. If the distances from the source to the receivers are not same, then in the noiseless case, one signal could be considered as the other with some shift in the time domain. In the noise-present case, since the noises are uncorrelated as described in Sec. 3, the noise in one signal can be considered as a part of the signal. The other signal could be viewed as the time shift of the former signal with some additive noise. Mathematically, these digital signals can be viewed as two sequences of samples and one sequence is considered as the superposition of the shift of the other sequence and some noise. This shift represents the TDOA between the two signals. In order to find the measure of this shift, one sequence is shifted again to find the best match with the other signal. The degree of linear coherence between these two sequences can be described by the correlation coefficient. The correlation of two vectors describes the degree of a linear relation between the two sequences. A correlation coefficient of 1 stands for a perfect positive linear relationship, a correlation coefficient of -1 means a perfect negative linear relationship and a correlation of 0 means no relationship at all. Higher correlation coefficient illustrates higher linear coherence. 16 The correlation coefficient of two sequences X and Y is computed as follows, cov(X,Y ) σX σY ∑ni=1 (Xi − X)(Yi −Y ) q =q . n n 2 2 ∑i=1 (Xi − X) ∑i=1 (Yi −Y ) r= (20) This implies that the process of determining the measure of the shift will proceed as follows: one of the sequences is shifted and the correlation coefficient between this and the unshifted sequence is being computed. Naturally, the goal is to find the shift at which the correlation coefficient displays the highest value. In case of long signals the shifting and comparing processes could result into rather high computational complexity. This complexity might be reduced by finding the maximum possible shift from some extra information such as the dimension of the room and the positions of the reference receiver and source. Given these information, the maximum possible TDOA can be derived. Assuming that the maximum possible distance from the source to a receiver is dmax and the distance between the source to the reference receiver is dsa , then the maximum possible TDOA can be computed as: T DOAmax = 1 max{dmax − dsa , dsa }. c (21) Therefore, the maximum measure of shift is derived: sampleshi f tmax = Fs max{dmax − dsa , dsa }, c (22) where Fs is the sample rate of the signals. In the practice, two receivers can not be perfectly synchronized, which means that the signals received by two receivers are also not perfectly synchronized. The consequence of this bad synchronization is that the obtained TDOA deviates from the real TDOA. Besides the synchronization, multi-path effect also causes inaccuracy. Due to the reflection and scattering, the received signal is a superposition of the signals from all the paths. As indicated in Sec. 3, it can be seen as the source signal convolved with the channel impulse response. Therefore the correlation between two received signals may not give an accurate TDOA. At last, the noise also increases the inaccuracy of obtained TDOA. The obtained TDOA is thus the sum of the real TDOA with the error due to synchronization, the error due to multi-path effect and the error due to the noise. Stage 2. Determining the region Without any synchronization error, noise, or multi-path effect, the obtained TDOA is equal to the real TDOA. Since the positions of the source and the reference receiver are given, the distance from the source to the reference receiver dsa can be computed. From obtained TDOA, the difference between dsa and the distance from the source to the mobile receiver dsm can be derived. Therefore, dsm can be obtained: dsm = dsa + ∆d = dsa + c × T DOA 17 (23) (24) Figure 7: Sketch of TDOA Figure 8: Sketch of obtained region from TDOA Using dsm , a circle around the source is obtained where the mobile receiver is located. A sketch is shown in Fig. 7. In practice, the synchronization error, noise and multi-path effect are always present. Hence, the obtained TDOA has certain deviation from the real TDOA. This inaccuracy becomes a margin as shown in Fig. 8. The obtained region is thus a ring with the source in the center. 5.2.2 The Fingerprinting Phase The Fingerprinting Part consists of three main stages: 1. Building the database 2. Signal processing 3. Comparing the received signals with the database Stage 1. Building the database Current Fingerprinting algorithms usually use some characteristics of the channel such as Received Signal Strength, Angle of Arrival or Time of Arrival to build the fingerprinting database 18 [1, 23, 24]. This implies that even small amendments to the rooms would require a complete reconstruction of the database. Although the concept of Fingerprinting is the same, the proposed implementation in this work is quite different. The real wave form samples are stored in the proposed database, which means that the database consists of the whole channels. This requires more memory than the conventional Fingerprinting, but provides more information about the room. First of all an imaginary grid within the room is made. As mentioned in the previous section, a Cartesian coordinate system is defined for the room. The produced imaginary grid corresponds to this coordinate system and its axis are parallel to it. Due to this the coordinates of each point on the grid may be computed rather quickly as the location of that particular point. The Fingerprinting database consists of the measurements taken within the room in question. These particular measurements consist of audio samples which are recorded at each of the imaginary grid points. Each unit in the database consists of the location of a point and the corresponding audio sample. Stage 2. Signal processing Stage 2a. Filtering and down-sampling It is important to consider the fact that there could be many small objects in the room. Each of them could reflect the sound waves, which contributes to the multi-path effect. The change of the location of these small objects would also change the channels. Since these small objects could be easily moved something needs to be done to reduce the impact of the reflections introduced by them. Due to this signals of long wave lengths are preferred. For a sound wave, a phase difference between two points is considered stable if the change of the phase difference for a single frequency is small. In order to have a stable phase difference between two grid points, a long wave length is expected compared with the distance between two neighbouring grid points. If the wave length is much smaller than the distance between two neighbouring grid points, the phase difference of the wave between grid points can vary a lot. Hence, long wave lengths, or in other words, low frequency components are desired. In a room with strong multi-path effect, the channel can be considered correlated only over a distance of λ/2, where λ is the wave length [5]. Then an adequate distance d between two neighbouring grid points is about λ. Because Fingerprinting can not cover all the positions in a room. Once the mobile receiver is located between two neighbouring grid points, we would like the channel from the source to the mobile receiver to be correlated to the channel from the source to a grid point nearby the mobile receiver. If d is much longer than λ, then the channel from the source to the mobile receiver can be uncorrelated to all channels to the nearby grid points. The most common sampling rates for digital audio are 44.1 kHz, 48 kHz, 88.2 kHz, 96 kHz and 192 kHz [25]. Even for the lowest sampling rate 44.1 kHz, the wave length is less than 1 cm. The sampling rate is thus much higher than the desired frequency components. Usually it is possible to change the sampling rate of the mobile phone with an anti-aliasing filter. If this is not the case both down-sampling and filtering has to be performed. There are many different low-pass filters, among which the Butterworth filter was chosen [26]. The most important property of a Butterworth filter is its possession of a maximally flat magnitude in the passband. The Butterworth filter is chosen to implemented because 19 the distortion to low frequency component is minimal. The cut-off frequency of the filter is determined by the distance between grid points and the original audio sampling rates. For example, if the distance between nearby grid points is around 0.5 m, for a sound wave with similar wave length, the frequency is around 680 Hz.The Nyquist frequency will be around 1360 Hz in this particular case. If the original sampling frequency is 44.1 kHz, then 1470 Hz = 44100 Hz/30 is a good choice. In this case an integer ratio between the original sampling frequency and the cut-off frequency is desired due to its convenience for down-sampling. As soon as filtering has taken place, the highest frequency component is much lower than the original sampling frequency, which means that the signals can be down-sampled without losing information. The down-sampling could reduce the amount of computing work and is therefore a crucial process. In the digital world, signals are some sequences. If an arbitrary ratio is chosen for the down-sampling, interpolation of the signals needs to take place before the implementation of the down - sampling. Naturally, this would increase the computational complexity. An integer ratio is thus desired. Stage 2b. Processing the database and the received signals Since use is being made of signals of opportunity, there is no knowledge about the received signals which will be compared later on. Therefore the signal to be compared can be considered as a different signal from the database. Before the comparison, both the received signals and the signals in the database need to be processed to eliminate the impact of the different source signals. As defined in the previous section, a mathematical model could be constructed for this particular problem. In this particular case two different source signals are being taken into consideration. One is the source signal used to build the database, denoted as sA . And the other is the signal sent by the source when localizing the mobile phone, which is denoted as sB . Since there are two microphones on the smart-phone, two different channels are being considered. The impulse response of the channel from the source to one microphone is defined as h1 and the impulse response from the source to the other microphone is defined as h2 . First the noiseless case will be looked at. One point in the database consists of two sequences defined in time and frequency domains as follows, x1[n] = sA [n] ∗ h1 [n] F X1[ω] = SA [ω]H1 [ω] − → x2[n] = sA [n] ∗ h2 [n] X2[ω] = SA [ω]H2 [ω]. (25) The received signals at the same point can be defined in similar way, x3[n] = sB [n] ∗ h1 [n] F X3[ω] = SB [ω]H1 [ω] − → x4[n] = sB [n] ∗ h2 [n] X4[ω] = SB [ω]H2 [ω]. (26) As described in Sec.3, this thesis focuses on two kind of source signals, white noise and speech signal. These two are common acoustic signals which can be experienced in a room rather easily.Possible occurrences are the noise from an air conditioner or a speaker used for announcements. For example, white noise from an air conditioner or a loudspeaker for announcement. White noise is stationary, which implies that its joint probability distribution does not change with the shift in time or space. While speech signal is less ideal than white noise: it is not stationary, but it has only short-term correlations [27]. Therefore, it can be assumed that it is not correlated in the long term. There are four proposed methods for the signal processing. 20 • Cross-correlation First of all the cross-correlation between the signals received at two microphones is computed. In time domain, the cross-correlation between x1 and x2 can be written as (x1 ? x2 )[n] = x1 [−n] ∗ x2 [n] = (sA [−n] ∗ h1 [−n]) ∗ (sA [n] ∗ h2 [n]) = (sA [−n] ∗ sA [n]) ∗ (h1 [−n] ∗ h2 [n]) (27) = rA [n] ∗ (h1 [−n] ∗ h2 [n]). The sequence rA [n] is the auto-correlation sequence of sA [n]. For a long stationary sequence sA [n], rA [n] is expected to have a pronounced peak at rA [0] with relatively small side-lobes. White noise is a good example of this phenomenon. Speech signal is not the best case, but usually a pronounced peak can be expected. Therefore (27) can be approximately reduced to (x1 ? x2 )[n] ≈ rA [0](h1 [−n] ∗ h2 [n]). (28) (x3 ? x4 )[n] ≈ rB [0](h1 [−n] ∗ h2 [n]). (29) Similarly, we get rB [n] is the auto-correlation sequence of sB [n]. Therefore, the comparison between the database and the received signals becomes the comparison between the results of (28) and (29). However, if the side-lobes of rA [n] or rB [n] are not small enough, then due to the convolution in (27), the side-lobes will be convolved with (h1 [−n] ∗ h2 [n]). Naturally, this will also contribute to the cross-correlation of two signals and might possible result into a miss match between the received signal and the database. A similar operation could be performed in frequency domain and would look like the following, ∞ (X1 ? X2 )[ω] = ∑ ∞ X1∗ [ω0 ]X2 [ω + ω0 ] = ω0 =−∞ ∑ SA∗ [ω0 ]H1∗ [ω0 ]SA [ω + ω0 ]H2 [ω + ω0 ] ∑ SA∗ [ω0 ]SA [ω + ω0 ]H1∗ [ω0 ]H2 [ω + ω0 ]. ω0 =−∞ ∞ = ω0 =−∞ (30) If the source signal SA [ω] is wide-sense stationary, then the autocorrelation of SA is defined as RSSA [ω] = E[SA [ω + ω0 ]SA∗ [ω0 ]]. For certain channels H1 and H2 , with wide-sense stationary random process SA [ω], the expected value of (X1 ? X2 )[ω] is ∞ E[(X1 ? X2 )[ω]] = E[ ∑ SA∗ [ω0 ]SA [ω + ω0 ]H1∗ [ω0 ]H2 [ω + ω0 ]] ω0 =−∞ ∞ = ∑ E[SA∗ [ω0 ]SA [ω + ω0 ]]H1∗ [ω0 ]H2 [ω + ω0 ] ω0 =−∞ ∞ = RSSA [ω] ∑ H1∗ [ω0 ]H2 [ω + ω0 ] ω0 =−∞ = RSSA [ω](H1 ? H2 )[ω]. 21 (31) Although it is known that the expected value of a sequence is not equal to the sequence itself, in case of the standard deviation of SA [ω] being relative small, it is expected that the expected value is close to the real value. Eq. (30) can be thus approximately reduced to (X1 ? X2 )[ω] ≈ RSSA [ω](H1 ? H2 )[ω]. (32) And in the same way, we get (X3 ? X4 )[ω] ≈ RSSB [ω](H1 ? H2 )[ω]. (33) White noise is stationary in time as well as frequency domain. Thus this method can only be applied to source signals with small standard deviation as explained above. Thus the application is very limited. • Source cancellation As described in (25) and (26), the time domain signals in the database and received by the mobile phone could be described as the convolution of the source signals and the channels. The convolution of the signals are computed as follows, x1 [n] ∗ x4 [n] = (sA [n] ∗ h1 [n]) ∗ (sB [n] ∗ h2 [n]) = sA [n] ∗ sB [n] ∗ h1 [n] ∗ h2 [n], x2 [n] ∗ x3 [n] = (sA [n] ∗ h2 [n]) ∗ (sB [n] ∗ h1 [n]) = sA [n] ∗ sB [n] ∗ h1 [n] ∗ h2 [n]. (34) Using this method, the impact of the different sources is eliminated. However, if there is some time difference between the signals, for example the random processing delay of the mobile phone, then after computing the convolution, the difference between two sequences could be large. Another method is to cancel the sources in frequency domain. From (25) and (26), we have X1 [ω] SA [ω]H1 [ω] H1 [ω] = = X2 [ω] SA [ω]H2 [ω] H2 [ω] X3 [ω] SB [ω]H1 [ω] H1 [ω] = = . X4 [ω] SB [ω]H2 [ω] H2 [ω] (35) (36) In the frequency domain, delay of several samples does not introduce a large error in the time domain. Unfortunately, this particular method has some disadvantages as well. If some frequency components of h2 [n] are relatively small, the quotient at these frequencies will be quite large, possibly close to infinity. This problem could be solved by neglecting some frequency components. However, such a procedure varies per point and would result into extra computing work. • Source comparison In contrast to the method Source cancellation, the sources could also be compared instead. In time domain, a deconvolution would have to be performed twice. First the channel h1 [n] and h2 [n] are computed from deconvolution of x1 [n], sA [n] and x2 [n], sA [n]. Afterwards, sB [n] is computed from deconvolution of x3 [n], h1 [n] and x4 [n], h2 [n] respectively. If the location of the mobile phone matches with a particular grid point of the database, the computed sB [n] should be similar. However, deconvolution is not a desired method. Although many deconvolution algorithms exist, they require a lot of computation and the results could be unstable. Besides, the time difference 22 between the signals also introduces more error. Therefore, another approach is used. Similar to the method of source cancellation, it is also processed in frequency domain, X3 [ω] SB [ω]H1 [ω] SB [ω] = = X1 [ω] SA [ω]H1 [ω] SA [ω] X4 [ω] SB [ω]H2 [ω] SB [ω] = = . X2 [ω] SA [ω]H2 [ω] SA [ω] (37) (38) This method does not only solve the problem concerning deconvolution and time delay, but also has an advantage in case of the division. Since sA [n] is the source signal used to build the database it is possible to choose some broadband signals such as white noise as source signals intentionally. Due to this the quotients are much more stable than in the case of the method of source cancellation. According to the statements above, experiments were carried out using four methods: cross-correlation both in time and frequency domains, source cancellation in frequency domain and source comparison in frequency domain. The accuracy yielded by these methods is discussed in Sec. 6. Stage 3. Comparing the received signals with the database In previous stage, a theoretical model without noise was used to derive the algorithms. If there is entirely no noise, the comparison between the database and received signals is simple, since it can be expected that the best fit is between two of the same signals. In practice, however, there is always noise. Therefore an analysis concerning the impact of the noise has been performed in order to choose the best technique of comparison. Using (3), the model of signals become, x1 [n] = sA [n] ∗ h1 [n] + w1 [n], x2 [n] = sA [n] ∗ h2 [n] + w2 [n], x3 [n] = sB [n] ∗ h1 [n] + w3 [n], (39) x4 [n] = sB [n] ∗ h2 [n] + w4 [n]. Eq. (27) of the Cross-correlation method in the time domain becomes, (x1 ? x2 )[n] = (sA [−n] ∗ h1 [−n] + w1 [n]) ∗ (sA [n] ∗ h2 [n] + w2 [n]) = (sA [−n] ∗ h1 [−n]) ∗ (sA [n] ∗ h2 [n]) + x2 [n] ∗ w1 [n] + (sA [−n] ∗ h1 [−n]) ∗ w2 [n] ≈ rA [0](h1 [−n] ∗ h2 [n]) + x2 [n] ∗ w1 [n] + (sA [−n] ∗ h1 [−n]) ∗ w2 [n] ≈ rA [0](h1 [−n] ∗ h2 [n]) + wCC−T [n]. (40) Compared with (27), the noises are convolved by x2 and sA [−n] ∗ h1 [−n]. The result could be considered as adding a new noise wCC−T [n]. 23 Eq. (30) of the Cross-correlation method in the frequency domain becomes, ∞ (X1 ? X2 )[ω] = ∑ (SA∗ [ω0 ]H1∗ [ω0 ] +W1∗ [ω0 ])(SA [ω + ω0 ]H2 [ω + ω0 ] +W2 [ω + ω0 ]) ∑ SA∗ [ω0 ]H1∗ [ω0 ]SA [ω + ω0 ]H2 [ω + ω0 ] ∑ (X2 [ω + ω0 ]W1∗ [ω0 ] + SA∗ [ω0 ]H2∗ [ω0 ]W2 [ω + ω0 ]) ∑ SA∗ [ω0 ]H1∗ [ω0 ]SA [ω + ω0 ]H2 [ω + ω0 ] +WCC−F [ω]. ω0 =−∞ ∞ = ω0 =−∞ ∞ + ω0 =−∞ ∞ = ω0 =−∞ (41) Similar to the time domain, the noises are convolved by X2 and SA H2 . The result could be viewed as adding a new noise WCC−F [ω]. Eq. (36) of source cancellation method becomes, X1 [ω] SA [ω]H1 [ω] +W1 [ω] = X2 [ω] SA [ω]H2 [ω] +W2 [ω] = (42) 1 [ω] H1 [ω] + W SA [ω] H2 [ω] + . W [ω] 2 SA [ω] Compared with (36), the noises are scaled by SA [ω]. Further on the impact of noise is scaled even more by the division. Eq. (38) of the source comparison method becomes, X3 [ω] SB [ω]H1 [ω] +W3 [ω] = X1 [ω] SA [ω]H1 [ω] +W1 [ω] = 3 [ω] SB [ω] + W H1 [ω] 1 [ω] SA [ω] + W H1 [ω] (43) . Compared with (38), the noises are scaled by H1 [ω]. Also, the impact of noise is scaled even further by the division. As witnessed from the above mentioned analysis, it is clear that there are two kinds of noise which tend to have an impact on the proposed algorithm. One is the convolution of noise with the signals and the other is the scaling of noise by signals or channels. There are many possible methods of comparison. The essence of comparison between the database and the received signals is comparison between two sequences of numbers, or two vectors as viewed from the perspective of linear algebra. The difference between two vectors needs to be defined by means of a measure. This measure needs to be robust against noise and linear transformations, and also save computing work. Robustness in case of linear translation implies that this measure between X,Y and αX+β, γY+δ (α,β,γ,δ are constants) are the same. This is rather useful in case of the suggested algorithm due to the fact that scaling and translation of the signals are common issues of the environment and the devices themselves. Several definitions of difference measure are listed as follows: 24 • Norm There are different definitions of norms. The most common one is q the so - called 2-norm. For example, consider a = [a1 , a2 , a3 ] ∈ R 3 , then norm(a) = a21 + a22 + a23 . If the dimension of the vectors is large, the norm is not an advisable choice. The problem with this particular method is the fact that too many vectors could have the same norm while some of them could still be unrelated at the same time. Thus this particular method is not robust in a noisy environment. Another disadvantage is being caused by the fact that the norm of a vector changes in case of a linear transformation. • Projection Another method to compare two vectors is by means of projecting one of the vectors onto the other and then compute the difference. In case of vectors x and y, the projection of x on y is, x·y Pro jy (x) = y. (44) y·y And the relative difference of Pro jy (x) and y is, ky − Pro jy (x)k . kyk (45) This comparison technique does give a measure of the difference between two vectors. But then again, it does vary with linear transformations of the vectors. • Correlation The advantage of using correlation coefficient is caused by its invariance to linear transformations. This particular property is really useful in practice. One problem of the correlation coefficient is that if one of the sequences has all the same elements, the correlation coefficient will become undefined, since the variance of it will be zero. Theoretically, this could lead to a problem for the methods Source cancellation and Source comparison, if a quotient of two sequences contains all the same elements. However, in practice, due to the noise, the chance that a sequence is the product of a factor and another sequence is so small that it is neglectable. Besides, according to the model described in Sec. 3, different channels and different noises are uncorrelated. Moreover, as explained in our analysis above, the signals are also (almost) uncorrelated. Therefore, the correlation coefficient is a good measure to distinguish between different channels. Taking all of the above mentioned information into consideration, correlation was chosen as the measure for the comparison. This due to its invariance to the linear transform, which is the desired property for the signals from different recorders and the fact that the theoretical disadvantage can be neglected in practice. 25 6 Tests and Results The algorithm has been tested in the EEMCS building. Two mobile phones provided by Sony were used during the tests. In case of the TDOA test one mobile phone was used as an anchor and the other one as the mobile receiver. During the Fingerprinting tests both of them were used to build the database and to record received signals as well. Several tests have been performed for different purposes as follows: 1. This test had taken place in a room of the EEMCS building. A 3 × 10 grid was made within this rectangular room. The distance between two neighbouring grid points was around 0.5 m. Two mobile phones were used to test the TDOA algorithm. The synchronization of the mobile phones has been dealt with in [28]. At this time, the synchronization problem was not solved yet. Therefore the expectation was a relatively large deviation of time between two mobile phones: the results can be viewed in Sec 6.1. 2. In another room of the EEMCS building, another test concerning the TDOA part of the algorithm has been performed. Also this time two mobile phones were used during the test. The difference with the first test is the application of the manual synchronization which was expected to improve the accuracy of the experiment. 3. The fingerprinting algorithm was tested in the same room with the same settings as the first test. In this case white noise and speech signals were used as source signals. 8 sample were taken per point per source signal. After the measurements the algorithm was implemented by means of Matlab which led to the results shown below. 6.1 Results of TDOA Test 1 The process of determining the time shift between two signals is shown in Fig. 9. The originally received two signals are shown in Fig. 9(a). Fig. 9(c) illustrates the relation between the shift and the correlation coefficient. The shift corresponding to the best match can be derived from that particular figure. Applying this shift to the received signals, the fitted signals are plotted in Fig. 9(b). The time difference of arrival originating from the measurement and processed by the algorithm is defined as T DOAcomputed . The actual time difference of arrival is defined as T DOAactual . The distance deviation ∆d of T DOAcomputed and T DOAactual is defined, ∆d(i) = c(T DOAcomputed − T DOAactual ), i = 1, 2, 3, ..., N. (46) N is the number of pair of points where the measurements have been performed. In Fig. 10, the distance deviation of T DOAcomputed and T DOAactual is plotted against the location of the grid points. This particular test measured the speech signal received at point (0, 1) against all grid points. The measurements of the remaining points against all grid points led to similar results, that is, the deviation is still large but seems to decrease as the distance between the mobile and reference receivers increases. 26 (a) Received two signals (b) After shifting back (c) Correlation coefficients Figure 9: The process of determining the time shift between two signals Figure 10: The distance deviation of TDOA method between point(0,1) and other points 27 Table 1: Results of test 2 Position 1 1 1 2 2 2 3 3 3 4 4 4 Measurement 1 2 3 1 2 3 1 2 3 1 2 3 T DOAcomputed (ms) 11.00 11.07 10.79 3.92 1.54 3.83 13.11 13.38 13.52 11.90 11.00 10.34 T DOAactual (ms) 8.74 8.74 8.74 4.22 4.22 4.22 11.54 11.54 11.54 13.49 13.49 13.49 difference (m) -0.7744 -0.7978 -0.7044 0.1037 0.9208 0.1348 -0.5382 -0.6316 -0.6783 0.5443 0.8556 1.0813 The Root-mean-square-deviation(RMSD) of the difference of distance is computed as follows, s ∑Ni=1 ∆d 2 (i) RMSDd = = 2.5686m. (47) N However, this particular result is not really accurate due to a lack of a reasonable method of synchronization at the time. The consequence is that some TDOA measurements display large deviation which is not caused by the TDOA algorithm itself. The details are discussed in Sec. 7. Test 2 This test was performed in order to determine whether the TDOA part of the proposed algorithm would function in a real world situation. During the test the signals were synchronized manually. This was accomplished by transmitting a pulse (caused by a clap of hands) at an equal distance from the two receivers. The reference receiver and the source were placed in such a way that the distance ds,a was equal to 5.96 meters. The mobile receiver was located at four different positions, resulting in ds,m = 2.96, 4.51, 2.0, 1.33 meters. For each position three measurements were performed. The results of the measurement and subsequent TDOA extraction are shown in Tab. 1. The RMSDd of this test is equal to 0.7045 m. 6.2 Results of Fingerprinting Test 3 As described in the previous section, after using the TDOA algorithm, a small region is obtained where the mobile phone can be found. The Fingerprinting algorithm will be applied to this small region to improve the accuracy of the localization. Therefore, the accuracy of Fingerprinting also depends on the accuracy of the TDOA method. The smaller the region provided by the TDOA , the higher the accuracy of the output of the Fingerprinting part. In order to study the 28 accuracy of Fingerprinting given a certain region, the Fingerprinting algorithm was tested √ √ with different radius√of the region. During the analysis the radius varied from 2/2 m to 5 2/2 m. Here a step of 2/2 m is used for the radius. There are 30 grid points, 2 source signals and 8 wave forms per point per signal. Using one wave form as database and one other wave form as received signal there is a total of 240 combinations for each region. Four methods introduced in Sec. 5 were applied to all the grid points in the given region. As a reference, a random method was also computed. Firstly the correlation coefficient for each point is derived. During the random method, a uniform distributed random value as correlation coefficient for each point was generated. Furthermore, the error of the correlation coefficient for each combination of the signal types is defined as, ec (i, j) = Cmax (i, j) −Creceiver (i, j) , i = 1, 2, 3, ..., 30, j = 1, 2, 3, ..., 56, (57, ..., 64). Cmax (i, j) (48) where Cmax is the maximum of correlation coefficient in this region, and Creceiver is the correlation coefficient using j-th combination of wave forms at the i-th point, where the mobile receiver is situated. If the same type of signals are used for both received signals and the database, there are 7 × 8 = 56 combinations of wave forms. In other cases there are 8 × 8 = 64 combinations of wave forms. The total error of the correlation coefficients for all the grid points is defined as, ec,total = ec,total 30 56 1 ∑ ∑ ec (i, j), for same type of signals, 30 × 56 i=1 j=1 30 64 1 = ∑ ∑ ec (i, j), for different type of signals. 30 × 64 i=1 j=1 (49) In the same way, the difference between the maximum correlation coefficient and the averaged correlation coefficient is defined as, eg,total = 30 56 1 ∑ ∑ eg (i, j), for same type of signals, 30 × 56 i=1 j=1 eg,total = 30 64 1 ∑ ∑ eg (i, j), for different type of signals, 30 × 64 i=1 j=1 where eg (i, j) = Cmax (i, j) −Caverage (i, j) , i = 1, 2, 3, ..., 30, j = 1, 2, 3, ..., 56, (57, ..., 64). Cmax (i, j) (50) The results are shown in Fig. 11 and 12. These will be analysed in Sec. 7. Afterwards, the distance between the estimated location and the actual location is computed. The distance deviation d of the j-th combination of wave forms at i-th point is, q ˜ j) − Xm (i, j))2 + (Ym (i, ˜ j) −Ym (i, j))2 , i = 1, 2, 3, ..., 30, j = 1, 2, 3, ..., 56, (57, ..., 64). d(i, j) = (Xm (i, (51) 29 (a) white noise signals & white noise database (b) speech signals & speech database (c) speech signals & white noise database (d) white noise signals & speech database Figure 11: ec,total for different combination of the received signals and databases with five algorithms: CC-T (Cross-correlation in the time domain), CC-F (Cross-correlation in the frequency domain), SCancellation (Source cancellation), SComparison (Source comparison), random 30 (a) white noise signals & white noise database (b) speech signals & speech database (c) speech signals & white noise database (d) white noise signals & speech database Figure 12: eg,total for different combination of the received signals and databases with five algorithms: CC-T (Cross-correlation in the time domain), CC-F (Cross-correlation in the frequency domain), SCancellation (Source cancellation), SComparison (Source comparison), random 31 (a) white noise signals & white noise database (b) speech signals & speech database (c) speech signals & white noise database (d) white noise signals & speech database Figure 13: RMSDs in meter for different combination of the received signals and databases with five algorithms: CC-T (Cross-correlation in the time domain), CC-F (Cross-correlation in the frequency domain), SCancellation (Source cancellation), SComparison (Source comparison), random The root mean square deviation of distance for one combination of types of signals is defined as follows, s 56 2 ∑30 i=1 ∑ j=1 d (i, j) RMSDd,total = , for the same type of signals, 30 × 56 (52) s 64 2 (i, j) d ∑ ∑30 i=1 j=1 RMSDd,total = , for different type of signals. 30 × 64 The results of RMSD are shown in Fig.13. This will be analysed in Sec. 7. 32 7 Discussion In this part of the thesis all the tests will be reflected upon. Test 1 Fig. 9 shows that after the back shifting, two signals can be matched. It illustrates that the shift can be found using the proposed algorithm. However, during the test, large and random deviations were presented due to the synchronization problem. The synchronization between two mobile phones was not well implemented at that time. Therefore among all the errors, the error introduced by bad synchronization was dominant. To reduce this error, a better synchronization is desired. Test 2 The objective of the second test is to examine if the algorithm works with a reasonably good synchronization. From Tab. 1, it can be seen that with manual synchronization, the algorithm gives relatively small errors. In the practice, manual synchronization is not realistic. This test proves that the algorithm will give sufficient results given a reasonably good synchronization. The synchronization problem is usually expected to be solved via hardware/software implementation. However, if it can not be done, there is also possibility to estimate and compensate the errors from bad synchronization using statistic models. This approach is beyond the scope of this thesis and is thus not to be discussed in detail. Test 3 The results are being revealed in Sec. 6. First of all each one of the four proposed comparison techniques is being analysed. Cross-correlation in the time domain When comparing Fig. 11(a), 11(b), 11(c) and 11(d), one is confronted with the following : the test results match the analysis stated in Sec.5 which implied that the cross - correlation in time domain would display the best performance in case of a white noise - white noise combination. The worst results concerning this particular method are observed in case of a speech - speech combination. The reason for this lies within the fact that white noise is uncorrelated with a particular shift in time while the speech signal is known for short term correlation. Due to this the side-lobes of the autocorrelation of the speech signal are relatively large when compared to those of white noise. The same conclusion can be drawn from Fig. 13(a), 13(b), 13(c) and 13(d). Cross-correlation in the frequency domain When comparing the results of the cross-correlation algorithm in the frequency domain as displayed in Fig. 11(a), 11(b), 11(c) and 11(d), it is relatively easy to note that the difference between the maximum correlation coefficient and the correlation coefficient at the desired point is rather small. However, the differences between various combinations of signals as conveyed by means of Fig. 11(a), 11(b), 11(c) and 11(d) do not correspond to Fig. 13(a), 13(b), 13(c) and 13(d). This originates from the standard deviation of the source signals and therefore there is no significant difference amongst the correlation coefficients. This conclusion is confirmed by the information represented in Fig. 12(a), 12(b), 12(c) and 12(d). 33 Source cancellation From Fig. 11(a), 11(b), 11(c) and 11(d), a substantial increase of ec,total is observed in case of an increase of the given region. The relative error of the correlation coefficient is relatively large, except for the combination of white noise from the source and white noise from the database. Fig. 12(a), 12(b), 12(c) and 12(d) illustrate that the difference among the correlation coefficients is also quite large. Due to this stable results may be witnessed in 13(b), 13(c) and 13(d) while even better results are being displayed in 13(a). Source comparison From Fig. 11(a), 11(b), 11(c), 11(d), Fig.12(a), 12(b), 12(c) and 12(d) it is observed that the source comparison algorithm is quite stable amongst the four implemented combinations . The same conclusion can also be drawn from Fig. 13(a), 13(b), 13(c) and 13(d). Finally, a comparison is being made between the four proposed techniques to find a match between an audio signal of the database and a random audio sample. When having a look at Fig. 13(a), 13(c) and 13(d) it becomes clear that cross-correlation in the time domain is the best algorithm amongst the four propositions. Its performance is not too bad as well in comparison to the other three methods according to Fig 13(b). 34 8 Conclusion Indoor localization using signals of opportunity is an interesting and promising topic. One of the choices made during this work was to focus on acoustic signals which is caused by the fact that this particular type of signals has a much lower speed than the ones of an electromagnetic origin. Naturally, this implies that any possible timing inaccuracies would lead to smaller deviations in the localization process. This work placed the emphasis on a rectangular room as shown in Fig. 1 without loss of generality. The contents of the room are the following: a source producing an acoustic signal, a reference receiver and a mobile receiver. The main goal is the derivation of the position of the mobile receiver. A Wide-Sense-Stationary Uncorrelated Scattering model [13] is used to describe the room and the channel model is defined in (2) and (3). Back to the requirements described in Sec. 2, the requirements for the algorithm are sufficiently satisfied. The proposed algorithm is able to localize a mobile phone in a convex room using acoustic signals of opportunity. The indoor localization algorithm proposed in this particular work is a combination of the Time Difference of Arrival and Fingerprinting. The first phase is the computation of the TDOA between the reference receiver and the mobile receiver which provides a possible region where the mobile receiver could be situated. The second phase consists of building database, signal processing and the comparison between the received signal from the mobile receiver and the one from the database. Four different approaches for signal processing have been presented. Both phases of the suggested algorithm were thoroughly tested. From those particular tests it appears that the TDOA part is functioning properly but strongly depends on the synchronization. However it is demonstrated that the algorithm itself works sufficiently. Unfortunately, the synchronization issue was not really solved yet and was merely minimized by means of manual synchronization. Another possibility to diminish the timing problems was to come up with a stochastic model of the situation (e.g. estimation or detection theory ), but our group considered such an analysis to be outside of the scope of the thesis especially due to the time limitations. The tests concerning the Fingerprinting part of the proposed algorithm were mainly undertaken to decide which one of the four comparison methods would come out on top. Cross - correlation in the time domain has shown the best performance during this testing. It is also worthwhile to note that this particular part of the algorithm displayed the finest results in case of a white noise being used to construct the database. As already mentioned in Sec.4 and 5, this suggested way of using the Fingerprinting technique is relatively new which implies that a lot of testing needs to take place in order to be able to come up with reasonable assumptions concerning the performance of the proposed algorithm. Although the proposed technique presented in this particular work requires additional testing the following conclusions may be drawn: the TDOA part of the algorithm does not improve on the state of the art while the Fingerprinting part introduces an interesting novelty with reasonable accuracy. The two parts working together ensures indoor localization with small deviations in an unprecedented manner. 35 9 Future work In scientific research there is always room for improvement and this work is no exception. This particular extract proposes an algorithm for which there are elements that could be explored in more detail in the future. The first element is the synchronization issue: although perfect synchronization does not exist, a sufficient synchronization can be achieved. This could be solved at the hardware level or at least some software diversions should be implemented. In case the above mentioned method is impossible to apply, a stochastic analysis of the situation should be performed. The second element is the TDOA. Although the synchronization definitely plays a huge role during the implementation of this particular technique, the TDOA itself requires a thorough exploration as well. This work focussed on the usage of the white noise as well as speech signals, but there are many other possibilities. By having a look at other kinds of signals the robustness of the method might be improved. Another interesting topic concerning the TDOA which deserves future attention is the presence of multiple sources. This work focusses on one source only and it would therefore be worthwhile to consider the implications of the increment of the amount of sources. The final element is the Fingerprinting. In this case two following aspects should be experimented with in the future: the kind of signal used to build the database as well as the amount of sources present in a particular scenario. The conclusion of this work implies that the Fingerprinting is performing at its best when a white noise signal is being used, but this might be proven wrong empirically. Also, as the main focus of this thesis was on a situation with a single source producing a signal, the implications introduced by multiple sources is the next logical step. And finally the last weak link of the Fingerprinting part: the applicability within the real world. It is not too hard to imagine the fact that not too many individuals would be pleased to be obliged to construct a database of each and every room where indoor localization would be applied later. A possible solution to this convenience problem would be the creation of a so-called virtual database which would make the long lasting measurements redundant. The idea would be to construct the database by means of simulation, taking the dimensions as well as any present object of the room into the consideration. 36 References [1] A. Tayebi, J. Gomez, F. Saez de Adana and O. Gutierrez, "The Application of Ray-Tracing to Mobile Localization Using the Direction of Arrival and Received Signal Strength in Multipath Indoor Enviroments" Progress In Electromagnetics Research, PIER 91, 1-15, 2009 [2] G. Fischer, B. Dietrich and F. Winkler, "Bluetooth Indoor Localization System" [3] C. Zang, M. Kuhn, B. Merkl, A.E. Fathy and M.Mahfouz, "Accurate UWB Indoor Localization System Utilizing Time Difference of Arrival Approach" [4] Stefan Koenig, Mark T. Schmidt, Christian Hoene, "Multipath Mitigation for Indoor Localization Based on IEEE 802.11 Time - of - Flight Measurements" [5] A.H. Sayed, A. Tarighat, and N. Khajehnouri, "Network-based wireless location", IEEE Signal Processing Magazine, vol. 22, pp. 24-40, July 2005 [6] E. D. Kaplan, C. J. Hegarty, "Understanding GPS: Principles and Applications", London, UK. : Artech House, 2006. [7] Fredrick S. Solheim, Jothiram Vivekanandan, Randolph H. Ware, Christian Rocken, "Propogation delays induced in GPS signals by dry air, water vapour, hydrometeors, and other particulates" [8] R.K. Martin, J.S. Velotta, and J.F. Raquet, "Bandwidth efficient cooperative TDOA computation for multicarrier signals of opportunity", IEEE Trans. Signal Processing, vol. 57, pp. 2311-2322, June 2009. [9] Vahideh Moghtadaiee, Andrew G. Dempster, Samsung Lim," Indoor localization using FM radio signals: a fingerprinting approach" [10] Lionel M.Ni, Dian Zhang, Michael R. Souryal," RFID - based localization and tracking technologies" [11] Oriol Vinyals, Eladio Martin, Gerald Friedland," Multimodal indoor localization: an audio wireless - based approach " [12] Steadman, Philip. "Why are most buildings rectangular?." Architectural Research Quarterly 10.02 (2006): 119-130. [13] Kurth, R. R.; Snyder, D. L.; Hoversten, E. V. (1969) "Detection and Estimation Theory", Massachusetts Institute of Technology, Research Laboratory of Electronics, Quarterly Progress Report, No. 93 (IX), 177-205 [14] Nicoli, M., C. Morelli, and V. Rampa. "A jump Markov particle filter for localization of moving terminals in multipath indoor scenarios." Signal Processing, IEEE Transactions on 56.8 (2008): 3801-3809. [15] Yano, Scott M. "Investigating the ultra-wideband indoor wireless channel." Vehicular Technology Conference, 2002. VTC Spring 2002. IEEE 55th. Vol. 3. IEEE, 2002. [16] Huang, Y-D., and Mourad Barkat. "Near-field multiple source localization by passive sensor array." Antennas and Propagation, IEEE Transactions on 39.7 (1991): 968-975. 37 [17] D. Humprey and M. Hedley, "Super-Resolution Time of Arrival for Indoor Localization", 2008 [18] Wang, X., Z. X. Wang, and B. O. Dea, "A TOA-based location algorithm reducing the errors due to Non-Line-of-Sight (NLOS) propagation," IEEE Trans. Veh. Tech., Vol. 52, 112-116,Jan. 2003. [19] G. Gu, "Approximate MLE algorithm for source localization based on TDOA measurements", in Proc. SPIE Conf.: Defense and Security 2007 (Orlando, FL), Vol. 6577, April 9 - April 13, 2007. [20] K.C. Ho and W. Xu, "An accurate algebraic solution for moving source location using TDOA and FDOA measurements", IEEE Trans. Signal Processing vol 52 pp 2453-2463. Sept. 2004. [21] Y.T. Chan and K.C. Ho, "A simple and efficient estimator for hyperbolic location", IEEE Trans. Signal Processing, vol. 42, pp. 1905-1915, Aug. 1994. [22] B.T. Fang, "Simple solutions for hyperbolic and related position fixes", IEEE Trans. Aerosp. Electron. Syst., vol. 26, pp. 748-753, Sept. 1990. [23] A. Toak, N. Kandil and S. Affes, "Neural Networks for Fingerprinting-Based Indoor Localization Using Ultra-Wideband" Journal Of Communications, Vol. 4, No. 4, MAY 2009 [24] Evgeny Kupershtein, Mati Wax, Israel Cohen, "Single - site emitter localization via multipath fingerprinting", IEEE Transactions on signal processing, Vol. 61, No. 1, January 1, 2013. [25] Self, Douglas (2012). Audio Engineering Explained. Taylor & Francis US. pp. 200, 446. ISBN 0240812735. [26] Butterworth, Stephen. "On the theory of filter amplifiers." Wireless Engineer 7 (1930): 536-541. [27] Li, Ta-Hsin, and Jerry D. Gibson. "Time-correlation analysis of nonstationary signals with application to speech processing." Time-Frequency and Time-Scale Analysis, 1996., Proceedings of the IEEE-SP International Symposium on. IEEE, 1996. [28] A. Masoud, K. Warmerdam, "Implementation of Indoor Localization Using Signals of Opportunity on Android", TUDelft, bachelor thesis, 2013 38 A TDOA extractTDOA.m 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 f u n c t i o n [ TDOA_meter ] = extractTDOA ( Signal_m , S i g n a l _ r e f , max_meter , Fs ) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % E x t r a c t TDOA from two s i g n a l s . % S i g n a l _ m : r e c e i v e d s i g n a l from t h e m o b i l e r e c e i v e r . % S i g n a l _ r e f : r e c e i v e d s i g n a l from t h e r e f e r e n c e r e c e i v e r . % max_meter : t h e maximum p o s s i b l e d i f f e r e n c e . % Fs : s a m p l i n g r a t e . % TDOA_meter : TDOA c o n v e r t e d t o l e n g t h , which i s t h e " d i s t a n c e d i f f e r e n c e % of a r r i v a l " . %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % % % % % % % % % speed of sound c = 343.2; % r e d u c e t h e c o m p u t a t i o n by s e t t i n g up t h e maximum L e n g t h _ s i g n a l = min ( l e n g t h ( S i g n a l _ m ) , l e n g t h ( S i g n a l _ r e f ) ) ; p e r c e n t = max_meter / c ∗ Fs / L e n g t h _ s i g n a l ; % compute TDOA TDOA = c o m p a r e v e c t o r i n d e x ( Signal_m , S i g n a l _ r e f , p e r c e n t ) ; TDOA_meter = (TDOA/ Fs ) ∗ c ; end comparevectorindex.m 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 f u n c t i o n [ s h i f t ] = c o m p a r e v e c t o r i n d e x ( Sig1 , Sig2 , p e r c e n t ) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Compare two s i g n a l s t o f i n d t h e s h i f t . % Sig1 : the f i r s t s i g n a l . % Sig2 : the second s i g n a l . % p e r c e n t : t h e p e r c e n t a g e o f t h e s i g n a l l e n g t h which c a n be s h i f t e d . % s h i f t : t h e s a m p l e s h i f t f o u n d by t h i s f u n c t i o n . %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % c u t t h e s i g n a l s t o t h e same l e n g t h d i f f e r e n c e = l e n g t h ( Sig1 ) − l e n g t h ( Sig2 ) ; if difference > 0 S i g 1 = S i g 1 ( 1 : end−d i f f e r e n c e ) ; elseif difference < 0 S i g 2 = S i g 2 ( 1 : end + d i f f e r e n c e ) ; end % correlation R = z e r o s (1 , c e i l ( l e n g t h ( Sig2 ) ∗ p e r c e n t ∗2) ) ; f o r i = c e i l (− l e n g t h ( S i g 2 ) ∗ p e r c e n t ) : c e i l ( l e n g t h ( S i g 2 ) ∗ p e r c e n t ) % s h i f t one o f s i g n a l s i f i >= 0 X = [ z e r o s ( 1 , i ) S i g 2 ( 1 : end−i ) ] ; else j = −i ; X = [ S i g 2 ( j + 1 : end ) z e r o s ( 1 , j ) ] ; end 39 % % % % % % % 28 % compute c o r r e l a t i o n c o e f f i c i e n t 29 c o f = c o r r c o e f ( Sig1 , X) ; 30 R ( i + l e n g t h ( S i g 2 ) + 1) = c o f ( 1 , 2 ) ; 31 end 32 % f i n d t h e b e s t match 33 c o r c o f _ i n d e x = f i n d (R == max (R) ) ; 34 s h i f t = c o r c o f _ i n d e x −l e n g t h ( S i g 2 ) −1; 35 36 end 40 B Fingerprinting builddatabase_room_4.m 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 function [ h r _ l e f t , h r _ r i g h t ] = Builddatabase_room_4 ( Type_signal ) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Build the database . % % Type_signal : white noise , speech . . . % % h r _ l e f t : s i g n a l r e c e i v e d by f i r s t c h a n n e l o f t h e r e c e i v e r . % % h r _ r i g h t : s i g n a l r e c e i v e d by s e c o n d c h a n n e l o f t h e r e c e i v e r . % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % s e t up t h e s i z e Size_database = [2000 , 3 , 10]; hr_left = zeros ( Size_database ) ; hr_right = zeros ( Size_database ) ; % store the signals in the database f o r x =0:2 f o r y =0:9 % r e a d t h e . wav f i l e s s t r _ x =num2str ( x ) ; s t r _ y =num2str ( y ) ; str_naam= s t r c a t ( str_x , str_y , ’_ ’ , Type_signal ) ; temp_vec_2_bij_1 =( wavread ( str_naam ) ) ’ ; % store the signals h r _ l e f t ( : , x +1 , y + 1) = t e m p _ v e c _ 2 _ b i j _ 1 ( 1 , : ) ; h r _ r i g h t ( : , x +1 , y + 1) = t e m p _ v e c _ 2 _ b i j _ 1 ( 2 , : ) ; end end end Compare_CC_T.m 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 f u n c t i o n [ c o r c o f ] = Compare_CC_T ( h r _ l e f t , h r _ r i g h t , S i g _ l e f t , S i g _ r i g h t ) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Compare t h e r e c e i v e d s i g n a l w i t h t h e d a t a b a s e u s i n g C r o s s c o r r e l a t i o n % % i n t i m e domain method . % % h r _ l e f t : the database of the f i r s t channel . % % h r _ r i g h t : the database of the second channel . % % S i g _ l e f t : received signal at the f i r s t channel . % % S i g _ r i g h t : r e c e i v e d s i g n a l a t the second channel . % % corcof : a matrix contains c o r r e l a t i o n c o e f f i c i e n t s . % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % s e t up t h e s i z e dims = s i z e ( h r _ l e f t ) ; c o r c o f = z e r o s ( dims ( 2 ) , dims ( 3 ) ) ; % cross correlation X12 = x c o r r ( S i g _ l e f t , S i g _ r i g h t ) ; % compare t h e r e c e i v e d s i g n a l w i t h t h e d a t a b a s e f o r i = 1 : dims ( 2 ) ∗ dims ( 3 ) X34 = x c o r r ( h r _ l e f t ( : , i ) , h r _ r i g h t ( : , i ) ) ; 41 22 23 24 25 26 tmp = c o r r c o e f ( X12 , X34 ) ; c o r c o f ( i ) = tmp ( 2 ) ; end end Compare_CC_F.m 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 f u n c t i o n [ c o r c o f ] = Compare_CC_F ( h r _ l e f t , h r _ r i g h t , S i g _ l e f t , S i g _ r i g h t ) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Compare t h e r e c e i v e d s i g n a l w i t h t h e d a t a b a s e u s i n g C r o s s c o r r e l a t i o n % % i n f r e q u e n c y domain method . % % h r _ l e f t : the database of the f i r s t channel . % % h r _ r i g h t : the database of the second channel . % % S i g _ l e f t : received signal at the f i r s t channel . % % S i g _ r i g h t : r e c e i v e d s i g n a l a t the second channel . % % corcof : a matrix contains c o r r e l a t i o n c o e f f i c i e n t s . % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % s e t up t h e s i z e dims = s i z e ( h r _ l e f t ) ; c o r c o f = z e r o s ( dims ( 2 ) , dims ( 3 ) ) ; % r e c e i v e d s i g n a l s i n f r e q u e n c y domain X1 = f f t ( S i g _ l e f t ) ; X2 = f f t ( S i g _ r i g h t ) ; % cross correlation X12 = a b s ( x c o r r ( X1 , X2 ) ) ; % compare t h e r e c e i v e d s i g n a l s w i t h t h e d a t a b a s e f o r i = 1 : dims ( 2 ) ∗ dims ( 3 ) % d a t a b a s e i n t h e f r e q u e n c y domain X3 = f f t ( h r _ l e f t ( : , i ) ) ; X4 = f f t ( h r _ r i g h t ( : , i ) ) ; % cross correlation X34 = a b s ( x c o r r ( X3 , X4 ) ) ; % correlation coefficient tmp = c o r r c o e f ( X12 , X34 ) ; c o r c o f ( i ) = tmp ( 2 ) ; end end Compare_SCancellation.m 1 2 3 4 5 6 7 8 9 10 f u n c t i o n [ c o r c o f ]= Compare_SCancellation ( h r _ l e f t , h r _ r i g h t , S i g _ l e f t , . . . Sig_right ) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Compare t h e r e c e i v e d s i g n a l w i t h t h e d a t a b a s e u s i n g S o u r c e % % c a n c e l l a t i o n method . % % h r _ l e f t : the database of the f i r s t channel . % % h r _ r i g h t : the database of the second channel . % % S i g _ l e f t : received signal at the f i r s t channel . % % S i g _ r i g h t : r e c e i v e d s i g n a l a t the second channel . % % corcof : a matrix contains c o r r e l a t i o n c o e f f i c i e n t s . % 42 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % s e t up t h e s i z e dims = s i z e ( h r _ l e f t ) ; X34 = z e r o s ( dims ) ; c o r c o f = z e r o s ( dims ( 2 ) , dims ( 3 ) ) ; % r e c e i v e d s i g n a l s i n t h e f r e q u e n c y domain X1 = a b s ( f f t ( S i g _ l e f t ) ) ; X2 = a b s ( f f t ( S i g _ r i g h t ) ) ; % d i v i d e t h e s i g n a l s i n t h e f r e q u e n c y domain X12 = X1 . / X2 ; % compare t h e r e c e i v e d s i g n a l w i t h t h e d a t a b a s e f o r i = 1 : dims ( 2 ) ∗ dims ( 3 ) % t h e d a t a b a s e i n t h e f r e q u e n c y domain X3 = a b s ( f f t ( h r _ l e f t ( : , i ) ) ) ; X4 = a b s ( f f t ( h r _ r i g h t ( : , i ) ) ) ; % dividing X34 ( : , i ) = X3 . / X4 ; % correlation coefficient tmp = c o r r c o e f ( X12 , X34 ( : , i ) ) ; c o r c o f ( i ) = tmp ( 2 ) ; end end Compare_SComparison.m 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 f u n c t i o n [ c o r c o f ] = Compare_SComparison ( h r _ l e f t , h r _ r i g h t , S i g _ l e f t , . . . Sig_right ) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Compare t h e r e c e i v e d s i g n a l w i t h t h e d a t a b a s e u s i n g S o u r c e c o m p a r i s o n % % method . % % h r _ l e f t : the database of the f i r s t channel . % % h r _ r i g h t : the database of the second channel . % % S i g _ l e f t : received signal at the f i r s t channel . % % S i g _ r i g h t : r e c e i v e d s i g n a l a t the second channel . % % corcof : a matrix contains c o r r e l a t i o n c o e f f i c i e n t s . % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % s e t up t h e s i z e dims = s i z e ( h r _ l e f t ) ; X3 = z e r o s ( dims ) ; X4 = z e r o s ( dims ) ; c o r c o f = z e r o s ( dims ( 2 ) , dims ( 3 ) ) ; % r e c e i v e d s i g n a l s i n t h e f r e q u e n c y domain X1 = a b s ( f f t ( S i g _ l e f t ) ) ; X2 = a b s ( f f t ( S i g _ r i g h t ) ) ; % d a t a b a s e i n t h e f r e q u e n c y domain X3 = a b s ( f f t ( h r _ l e f t ) ) ; X4 = a b s ( f f t ( h r _ r i g h t ) ) ; 43 27 % compare t h e r e c e i v e d s i g n a l s w i t h t h e d a t a b a s e 28 f o r i = 1 : dims ( 2 ) ∗ dims ( 3 ) 29 % dividing 30 X13 = X1 . / X3 ( : , i ) ; 31 X24 = X2 . / X4 ( : , i ) ; 32 33 % correlation coefficient 34 tmp = c o r r c o e f ( X13 , X24 ) ; 35 c o r c o f ( i ) = tmp ( 2 ) ; 36 end 37 38 end Compare_Random.m 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 f u n c t i o n [ c o r c o f ] = Compare_Random ( h r _ l e f t , h r _ r i g h t , %%%%%%%%%%%%%%%%%%%%%%%%%%% % Compare t h e r e c e i v e d s i g n a l w i t h t h e d a t a b a s e u s i n g % h r _ l e f t : the database of the f i r s t channel . % h r _ r i g h t : the database of the second channel . % S i g _ l e f t : received signal at the f i r s t channel . % S i g _ r i g h t : r e c e i v e d s i g n a l a t the second channel . % corcof : a matrix contains c o r r e l a t i o n c o e f f i c i e n t s . %%%%%%%%%%%%%%%%%%%%%%%%%%% % s e t up t h e s i z e dims = s i z e ( h r _ l e f t ) ; % compute random m a t r i x c o r c o f = r a n d ( dims ( 2 : end ) ) ; end 44 Sig_left , Sig_right ) %%%%%%%%%%% Random method % % % % % % %%%%%%%%%%%

* Your assessment is very important for improving the work of artificial intelligence, which forms the content of this project

### Related manuals

Download PDF

advertisement