nexmonster / nexmon_csi

Channel State Information for Raspberry Pi. Use the pi-5.10.92 branch.
https://github.com/nexmonster/nexmon_csi/tree/pi-5.10.92
60 stars 26 forks source link

Amplitude when using matlab code #40

Open yama1111 opened 1 year ago

yama1111 commented 1 year ago

Hello. I am using your system to obtain CSI, and I have a question that I would like your help with.

To give you some background, I have installed the system on an ASUS RT-AC86U and obtained the CSI by following the instructions in Installing Nexmon_csi #2. Specifically, I am using iperf3 for UDP communication between a PC and another ASUS RT-AC86U to obtain the CSI.

I then used the pcap file obtained from these two devices with csireader.m, which is available at the following URL: https://github.com/seemoo-lab/nexmon_csi/tree/master/utils/matlab

The CSI I obtained is the first and second image. The data I want to retrieve looks like the third image

Thank you in advance for your help.

CSI CSI1 CSI3

zeroby0 commented 1 year ago

Some subcarriers have arbitrarily high values for some reason. You can set their value to 0 so that the rest of the CSI is not over shadowed.

This article lists the positions of null and pilot subcarriers which have huge values: https://www.oreilly.com/library/view/80211ac-a-survival/9781449357702/ch02.html

If you like Python, you can use nexcsi (https://github.com/nexmonster/nexcsi, pip install nexcsi) and plot them.

import numpy as np
import matplotlib.pyplot as plt

from nexcsi import decoder

device = "rtac86u" # nexus5, nexus6p, rtac86u
samples = decoder(device).read_pcap('path-to-pcap-file.pcap')

# Accessing CSI as type complex64
csi = decoder(device).unpack(samples['csi'], zero_nulls=True, zero_pilots=True)

f, (ax1, ax2) = plt.subplots(2, 1)
ax1.plot(np.abs(csi[0])) # Amplitude
ax2.plot(np.angle(csi[0])) # Phase

plt.show()

Screenshot from 2023-05-10 14-38-12

yama1111 commented 1 year ago

Thank you for your prompt reply. And sorry for the delay in getting back to you from us.

The point that the designated sub-carrier will have an expensive atai I understand that by setting the value to 0, the value will be clean.

But the high value of the CSI data I mentioned seems to be coming from a different subcarrier than the specified location.

Thank you in advance for your help.

zeroby0 commented 1 year ago

If it's at different CSI locations, it's valid CSI data.