read data

% data format:
%   1) link(TX position, line, RX position, frequency band), where frequency
% band 1: 6.75 GHz, 2: 30 GHz, 3: 60 GHz
%   2) valid_idx 1: this measurement can be used, 0: this measurement is
% corrupted
%
% Details:
% link
%     Value (1x4053x2x7x4x1x1): CIR (snapshot,delay,polarization,tx az.
%     scan, tx el. scan, rx az. scan, rx el. scan)
%     txAz 1x7: angles in the TX scans in azimuth
%     txEl 1x4: angles in the TX scans in elevation
%     rxAz 1x1: angles in the RX scans in azimuth
%     rxEl 1x1: angles in the RX scans in elevation
%     Dim 1x7: dimensions of each 
%     TX_id: TX label
%     TX_xyz: TX position (x,y,z) (see map)
%     RX_id: RX label
%     RX_xyz: RX position (x,y,z) (see map)
%     Visibility: LOS, NLOS

%% read data
close all; clear all; clc;

load('Bosch')

frequency_label = {'6.75 GHz','30 GHz','60 GHz'};

%% calculate TX RX distance
clc; close all;
for tt = 1:size(link,1)    
    for ll = 1:size(link,2)
        for rr = 1:size(link,3)
            for bb = 1:size(link,4)            
                if valid_idx(tt,ll,rr,bb) == 1
                    TXRX_distance(tt,ll,rr,bb) = sqrt(sum(abs(link(tt,ll,rr,bb).TX_xyz - link(tt,ll,rr,bb).RX_xyz).^2));                    
                else
                    TXRX_distance(tt,ll,rr,bb) = NaN;
                end
            end
        end
    end
end

%% Multi-band PDP per position

close all; clc;
clear PDP PAP

%define dR for visualization
DR_dB = 30;
% axis are from a valid measurement
tau = link(1,1,10,1).Dim(2).Value(1:4053).*1E-9;

c0 = 299792458;

for tt = 1:size(link,1)    
    for ll = 1:size(link,2)
        for rr = 1:size(link,3)
            for bb = 1:size(link,4)
                        
                if valid_idx(tt,ll,rr,bb)
                    
                    PDP(tt,ll,rr,bb,:) = squeeze(10*log10( ...
                        mean(abs(link(tt,ll,rr,bb).Value(:,:,1,:)).^2,4)));                                       
                    RX_id{tt,ll,rr,bb} = link(tt,ll,rr,bb).RX_id;                    
                else                    
                    PDP(tt,ll,rr,bb,:) = nan(length(tau),1);                    
                    RX_id{tt,ll,rr,bb} = NaN;
                end
            end
            
            if sum(squeeze(valid_idx(tt,ll,rr,:)))
                
                figure
                aux = squeeze(PDP(tt,ll,rr,1,:));
                aux = aux-max(aux(:));
                aux(aux < -DR_dB) = -DR_dB;
                plot(tau.*c0,aux)
                hold on
                aux = squeeze(PDP(tt,ll,rr,2,:));
                aux = aux-max(aux(:));
                aux(aux < -DR_dB) = -DR_dB;                
                plot(tau.*c0,aux)
                aux = squeeze(PDP(tt,ll,rr,3,:));
                aux = aux-max(aux(:));
                aux(aux < -DR_dB) = -DR_dB;
                plot(tau.*c0,aux)
                axis([0 120 -DR_dB 0]);
                hold off
                grid on
                lH = legend( ...
                    [frequency_label{1} ' - ' RX_id{tt,ll,rr,1}], ...
                    [frequency_label{2} ' - ' RX_id{tt,ll,rr,2}], ...
                    [frequency_label{3} ' - ' RX_id{tt,ll,rr,3}])

                pause(1)
            end
        end
    end
end

%% PDP per line

close all; clc;
clear PDP 

%define dR for visualization
DR_dB = 30;
% axis are from a valid measurement
tau = link(1,1,10,1).Dim(2).Value(1:4053).*1E-9;

c0 = 299792458;

for tt = 1:size(link,1)    
    for ll = 1:size(link,2)
        for rr = 1:size(link,3)
            for bb = 1:size(link,4)
                        
                if valid_idx(tt,ll,rr,bb)
                    
                    PDP(tt,ll,rr,bb,:) = squeeze(10*log10( ...
                        mean(abs(link(tt,ll,rr,bb).Value(:,:,1,:)).^2,4)));
                    RX_id{tt,ll,rr,bb} = link(tt,ll,rr,bb).RX_id;
                    TXRX_d(tt,ll,rr,bb) = TXRX_distance(tt,ll,rr,bb);                                       
                    
                else
                    PDP(tt,ll,rr,bb,:) = nan(length(tau),1);
                    RX_id{tt,ll,rr,bb} = NaN;
                    TXRX_d(tt,ll,rr,bb) = NaN;
                end
            end                        
        end
                                
        %we limit the samples in delay domain to 120 m propagation
        %distance

        tau_idx = 1:find(tau.*c0 < 120,1,'last');

        figure            
        bb_idx = 1;
        aux = squeeze(PDP(tt,ll,:,bb_idx,tau_idx));
        aux = aux-max(aux(:));
        aux(aux < -DR_dB) = -DR_dB;
        surf(tau(tau_idx).*c0,squeeze(TXRX_d(tt,ll,:,bb_idx)),aux)
        shading interp
        axis([0 120 0 max(squeeze(TXRX_d(tt,ll,:,bb_idx))) -DR_dB 0]);
        grid on
        xlabel('Propagation distance (m)');
        ylabel('TX-RX distance (m)');
        zlabel('Norm. RX Power (dB)');
        view(25,75)
        title([frequency_label{bb_idx} ' - Line ' num2str(ll)]);

        figure
        bb_idx = 2;
        aux = squeeze(PDP(tt,ll,:,bb_idx,tau_idx));
        aux = aux-max(aux(:));
        aux(aux < -DR_dB) = -DR_dB;
        surf(tau(tau_idx).*c0,squeeze(TXRX_d(tt,ll,:,bb_idx)),aux)
        shading interp
        axis([0 120 0 max(squeeze(TXRX_d(tt,ll,:,bb_idx))) -DR_dB 0]);
        grid on
        xlabel('Propagation distance (m)');
        ylabel('TX-RX distance (m)');
        zlabel('Norm. RX Power (dB)');
        view(25,75)
        title([frequency_label{bb_idx} ' - Line ' num2str(ll)]);

        figure
        bb_idx = 3;
        aux = squeeze(PDP(tt,ll,:,bb_idx,tau_idx));
        aux = aux-max(aux(:));
        aux(aux < -DR_dB) = -DR_dB;
        surf(tau(tau_idx).*c0,squeeze(TXRX_d(tt,ll,:,bb_idx)),aux)
        shading interp
        axis([0 120 0 max(squeeze(TXRX_d(tt,ll,:,bb_idx))) -DR_dB 0]);
        grid on
        xlabel('Propagation distance (m)');
        ylabel('TX-RX distance (m)');
        zlabel('Norm. RX Power (dB)');
        view(25,75)
        title([frequency_label{bb_idx} ' - Line ' num2str(ll)]);

        pause        
    end
end
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值