⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 plots.m

📁 802.11仿真源码 对分析RSSI很有用的
💻 M
字号:
function Plots(sortWLAN, start, num, xlabel, ylabel, colourfit, colour, type, line, RSSI, PER)
%This function ->
%       Plots: Creates a series of plots based on the input data, where
%         the majority of inputs are passed from Graph.m.  

% NOTE: This function requires the MATLAB program Count_num.m  to be in the
% same working directory

i = start - 1;
 
while(i <= num)
    i = i + 1;
    [first, last] = Count_num(sortWLAN(line,:), i)  
    if(first == 0)
        test = i;
        continue;
    end
    dist = sortWLAN(3,first:last);
    if(RSSI == 1)
        rssi = sortWLAN(4,first:last);
    else
        rssi = sortWLAN(2,first:last); %PER
    end
    wgt = sortWLAN(5,first:last); 
    if(type == 1)   
         coorelation = corr2(dist, rssi)  
      first = first - 1;
      if (RSSI == 1)
        Graph(dist,rssi, 0, 12, wgt, xlabel, ylabel, ['Average RSSI against distance with ' num2str(i) ' operating WLAN using ', num2str(last - first), ' samples'], colourfit,colour,RSSI,PER,1);
      else
          Graph(dist,rssi, 0, 12, wgt, xlabel, ylabel, ['Distance against PER with ' num2str(i) ' operating WLAN using ', num2str(last - first), ' samples'], colourfit,colour,RSSI,PER,1);
      end
    end
    if(type == 2)
        i
        coorelation = corr2(dist, rssi)  
        switch i
            case 2
                word = 'Bathroom';
            case 3
                word = 'Bedroom';
            case 4
                word = 'Hallway';
            case 5
                word = 'Kitchen';
            case 6 
                word = 'Laundry';
            case 7
                word = 'Living';
            case 8
                word = 'Recess';
            case 9
                word = 'Toilet';
            case 10
                word = 'Office';
            case 11
                word = 'Unknown';
            case 12
                word = 'Garage';
            case 13
                word = 'Other';
        end
        first = first - 1;
        if(RSSI == 1)
            hold on
              Graph(dist,rssi, 0, 12, wgt, xlabel, ylabel, ['Average RSSI for calculated Distance in the ' word ' using ', num2str(last - first), ' samples'], colourfit, colour,RSSI,PER,1); 
            hold off
        else
            Graph(rssi,dist, 0, 12, wgt, xlabel, ylabel, ['PER for calculated Distance in the ' word ' using ', num2str(last - first), ' samples'], colourfit, colour,RSSI,PER,1); 
        end
%         pause;
    end
    if(type == 3)
        coorelation = corr2(dist, rssi)  
        switch i            
            case 0 
                word = 'without ducted airconditioning';
            case 1
                word = 'with ducted airconditioning';
        end
        first = first - 1;
        Graph(dist,rssi, 0, 12, wgt, xlabel, ylabel, ['Average RSSI for calculated Distance ' word ' using ', num2str(last - first), ' samples'], colourfit, colour,RSSI,PER,1);
    end
    if(type == 4)        
        switch i            
            case 0 
                word = '9 or more people within dwelling';
            case 1
                word = '1 person within dwelling';
            case 2
                word = '2 people within dwelling';
            case 3
                word = '3 people within dwelling';
            case 4
                word = '4 people within dwelling';
            case 5
                word = '5 people within dwelling';
            case 6
                word = '6 people within dwelling';
            case 7
                word = '7 people within dwelling';
            case 8
                word = '8 people within dwelling';
            case 9
                word = '9 people within dwelling';
        end
        Graph(dist,rssi, 0, 12, wgt, xlabel, ylabel, ['Average RSSI for calculated Distance with ' word ' using ', num2str(last - first), ' samples'], colourfit, colour,RSSI,PER,1);        
    end
    
end

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -