I am attempting to implement a generalized least squares estimator that uses a noise covariance matrix from measured data. The basic model is as follows

$$\hat{c}_{GLS} = \left(\bf{A}^T\bf{\Sigma}^{-1}\bf{A}\right)^{-1}\bf{A}^T\bf{\Sigma}^{-1}\bf{r}$$

where $\bf{A}$ is a matrix of my basis functions, $\bf{\Sigma}$ is the noise covariance matrix and $\bf{r}=[r_x r_y r_z]^T$ is a column vector of my vector measurements ordered as shown. Likewise the noise vector measurements are $\bf{n}=[n_x n_y n_z]^T$.

The statement is made in the paper that $\Sigma = E\left\{\bf{n}\bf{n}^T\right\}$, which results in $\Sigma$ being size $3N\times 3N$ which makes sense. However, when I do this I get horrible results and the structure of $\Sigma$ doesn't look right. I expect it to be diagonal dominant and then falling off.

  • My question is what am I doing wrong?
  • How do I build the noise covariance matrix correctly?

I have data for $\bf{n}=[n_x n_y n_z]^T$ It isn't just the $3\times 3$ covariance matrix I am use to dealing with.

Edit: added code

minutes = 5; NSamples = Fs*60*minutes; NOverlap = NSamples/2; Sigma = zeros(3*NSamples,3*NSamples); M=20;

for nn = 1:M

nStart = (nn-1)*NOverlap+1;
nStop  = nStart+NSamples-1;
nx = x1(nStart:nStop);
ny = y1(nStart:nStop);
nz = z1(nStart:nStop);
Rxx = xcov(nx );Rxx= (Rxx(NSamples:end));
Rxy = xcov(nx,ny );Rxy= (Rxy(NSamples:end));
Rxz = xcov(nx,nz );Rxz= (Rxz(NSamples:end));
Ryy = xcov(ny );Ryy= (Ryy(NSamples:end));
Rzz = xcov(nz );Rzz= (Rzz(NSamples:end));
Ryz = xcov(ny, nz );Ryz= (Ryz(NSamples:end));

N   = [toeplitz(Rxx) toeplitz(Rxy) toeplitz(Rxz);
       toeplitz(Rxy) toeplitz(Ryy) toeplitz(Ryz);
       toeplitz(Rxz) toeplitz(Ryz) toeplitz(Rzz)];
Sigma = N + Sigma; 

end Sigma = Sigma/M;

  • $\begingroup$ Maybe you did not implement the expectation operator. I mean it is correct that $\Sigma$ shoud be diagonal-dominant. And $\Sigma = E\{\bf{n}\bf{n}^T\}=\frac{1}{N}\sum_i \{\bf{n_i}\bf{n_i}^T\}$ where $\bf{n_i}$ is one realization of noise and $N$ is the number of realizations. $\endgroup$ – AlexTP Jun 13 '17 at 18:33
  • $\begingroup$ @AlexTP I did exactly what you describe and the matrix I get back is pure garbage, not diagonal dominant at all, not banded structure like I expect. $\endgroup$ – user7257 Jun 14 '17 at 13:55
  • $\begingroup$ Post your code and part of your result and we will see. $\endgroup$ – AlexTP Jun 14 '17 at 13:59
  • $\begingroup$ @AlexTP I added my MATLAB code. Sorry the delay, I was on travel. $\endgroup$ – user7257 Jun 20 '17 at 21:07
  • $\begingroup$ I dont know how your noise x1,y1,z1 were generated or were processed, but to have your expected result, i.e. diagonal dominant matrix, the elements of x1, y1,z1 must be uncorrelated. Below is the extra code I added NN = M * NOverlap * 2; x1 = randn(1,NN) + 1i * randn(1,NN); y1 = randn(1,NN) + 1i * randn(1,NN); z1 = randn(1,NN) + 1i * randn(1,NN); $\endgroup$ – AlexTP Jun 25 '17 at 7:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.