# Use music-doa on CSI

I have a matrix of Channel State Information (CSI) that is obtained from a WiFi card (using Linux CSI tool with intel 5300).

I try to use musicdoa() function in Matlab to estimate the direction of arrival of the paths of signals received by the receiver in a wireless link. However the result is completely random angle with which is constant with small variations.

Am I missing something with handling the data, is the covariance matrix CSI*CSI'?

This is what I wrote:

CSI = import_csi('sample_data/csi_out_3.dat');
time = size(CSI, 3);
locations = zeros(time, 1);

A = mean(CSI,3);
A_abs = abs(A);
A_abs_inv = 1/sum(A_abs(:));

for i = 1: time
CSI_multi = CSI(:,:,i).*conj(CSI(:,:,i));
Random_phase = A_abs_inv.*sum(CSI_multi,'all');
Bm = (1/Random_phase)*CSI(:,:,i) - A;
Rq = Bm*Bm';
R = spsmooth(Rq,1);
[doas,spec,specang] = musicdoa(R,1);
locations(i,:) = doas;
end

plot(locations, '-k')
ylabel('angle \theta/degree')
xlabel('packet # (time)')
title('DOA estimation based on MUSIC algorithm as a function of time')
grid on