前言:Intel5300网卡获取CSI数据的教程强烈推荐该博文
安装抓取WIFI CSI的工具
close all;clear;clc
load("datasets\test_1011\bow_ant1.mat","bow.mat")
bow_amp = abs(bow);
close all;clear;clc
load('datasets\test_1011\bow_ant1.mat')
test = angle(bow(1:30,:));
F = unwrap(test,pi,2);
% F = zeros(30,900);
% for ii = 1:900
% phase_real = phase(bow(1:30,ii));
% F(:,ii) = phase_real;
% end
m = [-28,-26,-24,-22,-20,-18,-16,-14,-12,-10,-8,-6,-4,-2,-1,1,3,5,7,9,11,13,15,17,19,21,23,25,27,28];
H = zeros(30,900);
% 线性变换
sum = 0;
for t = 1:30
sum = sum+F(t);
end
b = (1/30)*sum;
k = (F(30)-F(1))/(m(30)-m(1));
for i = 1:30 % 子载波迭代
H(i) = F(i)-k*m(i)-b;
end
hold on
subplot(1,3,1); plot(m,test(:,1),'r-');%原始相位图
title('原始的相位');xlabel('子载波索引');ylabel('相位');
subplot(1,3,2); plot(m,F(:,1),'k-'); %解卷绕后的相位图
title('解卷绕之后的相位');xlabel('子载波索引');ylabel('真实测量的相位');
subplot(1,3,3); plot(m,H,'b-'); %真实相位图
title('线性变换之后的相位');xlabel('子载波索引');ylabel('校准的相位');
hold off
使用phase函数,结果显示如下。
close all;clear;clc
load('datasets\test_1011\bow_ant1.mat')
test = angle(bow(1:30,:));
% F = unwrap(test,pi,2);
F = zeros(30,900);
for ii = 1:900
phase_real = phase(bow(1:30,ii));
F(:,ii) = phase_real;
end
m = [-28,-26,-24,-22,-20,-18,-16,-14,-12,-10,-8,-6,-4,-2,-1,1,3,5,7,9,11,13,15,17,19,21,23,25,27,28];
H = zeros(30,900);
% 线性变换
sum = 0;
for t = 1:30
sum = sum+F(t);
end
b = (1/30)*sum;
k = (F(30)-F(1))/(m(30)-m(1));
for i = 1:30 % 子载波迭代
H(i) = F(i)-k*m(i)-b;
end
hold on
subplot(1,3,1); plot(m,test(:,1),'r-');%原始相位图
title('原始的相位');xlabel('子载波索引');ylabel('相位');
subplot(1,3,2); plot(m,F(:,1),'k-'); %解卷绕后的相位图
title('解卷绕之后的相位');xlabel('子载波索引');ylabel('真实测量的相位');
subplot(1,3,3); plot(m,H,'b-'); %真实相位图
title('线性变换之后的相位');xlabel('子载波索引');ylabel('校准的相位');
hold off