MATLAB Code
MATLAB Propagation Simulation
The MATLAB propagation simulation exists as a main function
(Propagation_Simulation.m) that calls a number of sub-functions to perform simple tasks. Included below is the main function, as well as the sub-functions that were written for this project.
Propagation Modeling Function
function RSS =
Propagation_Simulation(wap,walls,fname) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %wap.posit x-y coordinates of WAP %wap.power measured power of WAP at 1m %wap.MAC MAC address of WAP %walls list of wall elements (start x-y, end x-y, WAF)
%fname
file
name
for
output %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% start = clock; % Start timer to time
measure
and
display
execution %%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Adjustable
Parameters %%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
n1 = 2.5; % Path loss exponent (PLE) within the break point distance
n2 = 3.33; % Path loss exponent (PLE) outside the break point distance
Dbp = 10; % Break point distance in meters Res = 8; % Resolution of simulation (in points per meter)
thresh_min = -100; % Value in dBm below which data will not be plotted thresh_max
=
0;
%
Value
in
dBm
above
which
data
will
be
clipped %%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%% Setup %%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %locate map correctly on XY plane
walls = wall_list_prep(walls,Res); %calculate length of each wall
wall_length = ((walls(:,1) - walls(:,3)).^2 ... + (walls(:,2) - walls(:,4)).^2).^.5;
wap.posit building_size
= round(wap.posit*Res)/Res;
=
%determine building dimensions
[ceil(Res*max([walls(:,1);walls(:,3)]))/Res...
ceil(Res*max([walls(:,2);walls(:,4)]))/Res];
%determine number of wall elements
num_walls = size(walls,1); %determins dimensions of matrices needed for calculations
mat_size = [num_walls building_size(1)*Res+1 building_size(2)*Res+1]; %expand wall vector information into matrices
WALL_X1 = expand2fit(walls(:,1),mat_size); WALL_Y1 =
expand2fit(walls(:,2),mat_size);
WALL_X2 = expand2fit(walls(:,3),mat_size); WALL_Y2 =
expand2fit(walls(:,4),mat_size); WALL_AF = expand2fit(walls(:,5),mat_size); %create coordinate matrices x = repmat(0:1/Res:building_size(1),building_size(2)*Res+1,1)'; y = repmat(0:1/Res:building_size(2),building_size(1)*Res+1,1); X = expand2fit(x,mat_size); Y =
expand2fit(y,mat_size); %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%
Calculations %%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %calculate distance from WAP to each point in building
path_dist = ((x - wap.posit(1)).^2 + (y - wap.posit(2)).^2).^.5; %calculate slope of path from WAP at each point path_m = make_finite((y-wap.posit(2))./(x-wap.posit(1)));
PATH_M = expand2fit(path_m,mat_size); %calculate (finite) inverse of path slope at
each point
path_m_inv = make_finite(1./path_m); %calculate (finite) wall slope at each point
wall_m = make_finite((walls(:,2)-walls(:,4))./(walls(:,1)-walls(:,3)));
WALL_M = expand2fit(wall_m,mat_size); %calculate (finite) inverse of wall slope at each point
wall_m_inv = make_finite(1./wall_m); %calculate x and y intercepts of all walls and paths
WALL_X_INT = expand2fit(walls(:,1)-walls(:,2).*wall_m_inv,mat_size); WALL_Y_INT = expand2fit(walls(:,2)-walls(:,1).*wall_m,mat_size);
expand2fit(wap.posit(1)-wap.posit(2).*path_m_inv,mat_size);
PATH_X_INT
PATH_Y_INT
= =
expand2fit(wap.posit(2)-wap.posit(1).*path_m,mat_size); %calculate free space losses, including break point (Cheung et. al.)
proploss_near = (10*log10((path_dist).^n1)); proploss_far =
(10*(log10((Dbp).^n1)+log10((path_dist/Dbp).^n2))); proploss_near(path_dist>Dbp) = proploss_far(path_dist>Dbp); proploss_combined = proploss_near;
%calculate angle between each path and each wall
THETA = abs(atan((WALL_M-PATH_M) ./ ( 1+WALL_M.*PATH_M))); %calculate x and y coordinates of all intersections between path and wall
X_INTSCT = (PATH_Y_INT-WALL_Y_INT) ./ (WALL_M-PATH_M); Y_INTSCT = WALL_M
.*
PATH_M
.*
(PATH_X_INT-WALL_X_INT)
./
(PATH_M-WALL_M);
Y_INTSCT(PATH_M == 0 & WALL_M == -intmax) = wap.posit(2); %for walls || or |_ to x-axis, fix intercept errors caused by inf. slopes
X_INTSCT(walls(:,1) == walls(:,3),:,:) = ... repmat(walls(walls(:,1) == walls(:,3),1), ... [1 building_size(1)*Res+1 building_size(2)*Res+1]); Y_INTSCT(walls(:,2) == walls(:,4),:,:) = ... repmat(walls(walls(:,2)
==
walls(:,4),2),
...
[1
building_size(1)*Res+1
building_size(2)*Res+1]); %determine dBm interference value for each wall at all points INTERFERENCE = WALL_AF./(.5*(1+max(sin(THETA),.1))); %determine which walls interfere with path to which points
INTERFERE_PATH = order_test(wap.posit(1),X_INTSCT,X)
INTERFERE_WALL
& ... =
order_test(wap.posit(2),Y_INTSCT,Y);
order_test(WALL_X1,X_INTSCT,WALL_X2) & ... order_test(WALL_Y1,Y_INTSCT,WALL_Y2); INTERFERE = INTERFERE_PATH & INTERFERE_WALL; %set interference values for walls that don't interfere to zero INTERFERENCE(~INTERFERE)=0; %add wall losses to free space losses
proploss_combined = proploss_combined + squeeze(sum(INTERFERENCE,1));
pl_new = 10.^(-proploss_combined/10); %%%%%%%%%%%
Diffraction %%%%%%%%%%% %initialize vector that will hold list of diffracted corners
diffracted = wap.posit; %display time to complete non multipath simulation
now = clock-start; display(['Time elapsed: '
num2str(now(6)+60*now(5))]) %initialize variable for WAP to edge pathlosses
pl = zeros(2*num_walls); %pre-calculate angles for diffraction simulation
dist_end1 = ((walls(:,1) - wap.posit(1)).^2 ... + (walls(:,2) - wap.posit(2)).^2).^.5; dist_end2 = ((walls(:,3) - wap.posit(1)).^2 ... + (walls(:,4) - wap.posit(2)).^2).^.5; theta1_end1 = acos(((dist_end1.^2 + wall_length.^2 - dist_end2.^2)) ... ./ (2.*dist_end1.*wall_length));
theta1_end2 = acos(((dist_end2.^2 + wall_length.^2 - dist_end1.^2)) ... ./ (2.*dist_end2.*wall_length)); %loop to test for diffraction at each end of each wall
for i = 1:2*num_walls %determine which wall of which end to test
wall = ceil(i/2); wall_end = mod(i+1,2)+1; %determine whether or not wall end is a corner
for
diffraction
[will_diffract
diffracted]
=
...
is_corner(walls,wall,wall_end,wap.posit,Res,diffracted); %if point is corner at which diffract will occur
if will_diffract %get x and y coord. of wall ends
plx = walls(wall,2*mod(i+1,2)+1); ply = walls(wall,2*mod(i+1,2)+2); plx_alt = walls(wall,2*mod(i,2)+1); ply_alt = walls(wall,2*mod(i,2)+2); %get proploss from WAP to wall end
pl(i)=proploss_combined(plx*Res+1,ply*Res+1); %get distance from WAP to both wall ends
path_dist = ((x - plx).^2 + (y - ply).^2).^.5; path_dist_alt = ((x - plx_alt).^2 + (y - ply_alt).^2).^.5; %calculate slope of path from WAP at each point
path_m = make_finite((y-ply)./(x-plx)); PATH_M =
expand2fit(path_m,mat_size); %calculate (finite) inverse of path slope at each point
path_m_inv = make_finite(1./path_m); %calculate x and y intercepts of paths
PATH_X_INT = expand2fit(plx-ply.*path_m_inv,mat_size); PATH_Y_INT =
expand2fit(ply-plx.*path_m,mat_size); %calculate free space losses
proploss2 = (10*log10((path_dist).^n1)); proploss_far = =
(10*(log10((Dbp).^n1)+log10((path_dist/Dbp).^n2))); proploss2(path_dist>Dbp)
proploss_far(path_dist>Dbp); proploss2 = make_finite(proploss2); %calculate angle between each path and each wall
THETA = atan((WALL_M-PATH_M) ./ ( 1+WALL_M.*PATH_M)); %get/calculate angles needed to calculate diffraction coefficient
theta_1 = eval(['theta1_end' num2str(wall_end)]); theta_1 = abs(theta_1(wall)); theta_2 = acos((path_dist.^2 + wall_length(wall).^2 ...
- path_dist_alt.^2) ... ./ (2.*path_dist.*wall_length(wall))); theta_2 = theta_2.*(-1).^(squeeze(INTERFERE_PATH(wall,:,:))-1);
theta_2
=
2*pi
-
mod(real(theta_2),2*pi); %calculate x and y coord. of intersections between path and wall
X_INTSCT = (PATH_Y_INT-WALL_Y_INT) ./ (WALL_M-PATH_M); Y_INTSCT = WALL_M .* PATH_M .* ... (PATH_X_INT-WALL_X_INT) ./ (PATH_M-WALL_M); %for walls || or |_ to x-axis, correct inf. slope errors X_INTSCT(walls(:,1) == walls(:,3),:,:) = ... repmat(walls(walls(:,1)
==
walls(:,3),1),
...
[1
building_size(1)*Res+1
building_size(2)*Res+1]); Y_INTSCT(walls(:,2) == walls(:,4),:,:) = ... repmat(walls(walls(:,2) == walls(:,4),2), ... [1 building_size(1)*Res+1 building_size(2)*Res+1]); %determine dBm interference value for each wall at all points
INTERFERENCE = make_finite(WALL_AF./max(sin(abs(THETA)),.1)); %determine which walls interfere with path to which points
INTERFERE = order_test(plx,X_INTSCT,X) & ... order_test(ply,Y_INTSCT,Y) & ...
order_test(WALL_X1,X_INTSCT,WALL_X2) & ...
order_test(WALL_Y1,Y_INTSCT,WALL_Y2); %set interference values for walls that don't interfere to zero
INTERFERENCE(~INTERFERE)=0; %add wall losses to free space losses
proploss2 = proploss2 + squeeze(sum(INTERFERENCE,1)); %calculate diffraction coefficient
D = squeeze(abs(-exp(-j*pi/4)/sqrt(2*pi) ... .*abs(csc(theta_2-theta_1)) ... .*sqrt(-sin(theta_2)./sin(theta_1)))); %remove infinite and unnecessary values from array
D(D==Inf | D==-Inf | isnan(D) | theta_2<=pi) = ... zeros(size(D(D==Inf | D==-Inf | isnan(D)
|
theta_2<=pi)));
D(D>1)
=
zeros(size(D(D>1)));
D(D<0)
=
zeros(size(D(D>1))); %calculate, correct, and add new pathlosses to running total pl_tmp
=
10.^(-pl(i)/10)*10.^(-proploss2/10).*D;
pl_tmp(isnan(pl_tmp))
=
zeros(size(pl_tmp(isnan(pl_tmp)))); pl_new = pl_new + (pl_tmp); %display progress and time elapsed
disp([num2str(i) ' of ' num2str(2*num_walls) ' complete']) now = clock-start; display(['Time elapsed: ' num2str(now(6)+60*now(5)) ' seconds']) end
end %convert proploss to decibels
proploss = -10*log10(pl_new); %subtract propagation losses from transmit power
RSS = wap.power - real(proploss); %remove low values to preserve plot scale RSS(RSS>thresh_max) = thresh_max; %clip high values to preserve plot scale RSS(RSS Results %%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%% Plot [TMP RSS] = down_sample(RSS); %downsample array to output resolution %call function to plot results SS_plot(building_size,walls,RSS,diffracted) %open file and save results fid = fopen([fname '.txt'],'w'); fprintf(fid,'%12s\\n',wap.MAC); fprintf(fid,'%8.0f%8.0f\\n',size(RSS)); format = [repmat('%8.2f',1,size(RSS,2)) '\\n']; fprintf(fid,format,fliplr(RSS')); fclose(fid); %clear variables from memory clear all return Supporting Functions The following functions, listed in the order they are called, perform tasks subordinate to the propagation simulation. wall_list_prep.m %This function translates wall position data to the origin and rounds %coordinate to the nearest multiple of a given resolution function wall_list_new = wall_list_prep(walls,Res) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %walls list of wall element coordinates (start x-y, end x-y) %Res Resolution of model (in m^- 1) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %round values to nearest multiple of resolution walls(:,1:4) = round(walls(:,1:4)*Res)/Res; %find coordinates of wall point closest to origin xmin = min([walls(:,1);walls(:,2)]); ymin = min([walls(:,2);walls(:,4)]); %translate coordinates to match closest corner to origin walls(:,1) = walls(:,1)-xmin; walls(:,3) = walls(:,3)-xmin; walls(:,2) = walls(:,2)-ymin; walls(:,4) = walls(:,4)-ymin; %return new wall list wall_list_new = walls; return expand2fit.m %This function expands vectors and arrays into the 3-d form used for matrix %calculations function out = expand2fit(in,fit_size) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %in input vector %Res size required to array operations %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %seperate fit vector dimensions x = fit_size(1); y = fit_size(2); z = fit_size(3); %if input is a vector if size(in) == [x 1] %repeat in two additional dimensions out = repmat(in,[1 y z]); %else if input is an array elseif size(in) == [y z] %repeat in one additional dimension out = repmat(reshape(in,[1 y z]),[x 1 1]); %if input is of invalid size, return an error else out = zeros(x,y,z); error('Invalid input to function \"expand2fit\"') end return make_finite.m %replaces infinite values with the maximum integer value of the system function y = make_finite(x) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %x input vector to be made finite %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %replace all infinite values with maximum integer of corresponding sign x(x==Inf)=intmax; x(x==-Inf)=-intmax; %return result y=x; return order_test.m %determines if the B input is between the A and C inputs, inclusive function bool = order_test(a, b, c) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %a first extreme value %b test value %c second extreme value %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %round values to nearest thousandth (tollerence) a = round(10^3*a)/10^3; b = round(10^3*b)/10^3; c = round(10^3*c)/10^3; %perform logical comparison bool = (a<=b&b<=c) | (a>=b&b>=c); return is_corner.m %This function searchs a list of walls for intersections with a given wall %in order to determine if a corner shape exists that would cause %significant diffraction function [is diffract] = is_corner(walls,wall,end_in,wap_xy,Res,diffract) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %walls list of wall element coordinates (start x-y, end x-y) %wall specific wall to be checked for intersections %end_in which end of specific wall to check for corners %wap_xy x-y coordinates of wireless access point %Res resolution of simulation %diffract list of already found corners to which any newfound corners % will be appended %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %assume that the end being tested is a corner is = 1; %reshape walls array into a list of ends ends = [walls(:,1:2) ; walls(:,3:4)]; %pre-allocate memory for intersection-count variable k = zeros(length(ends),1); %for each end of a wall for i = 1:length(ends) %determine if coordinates are the same as end of another wall if isequal(ends((end_in-1)*length(walls)+wall,:),ends(i,:)) %if coordinates are the same, set corresponding count bit to '1' k(i)=1; end %if more than one overlap (in addition to overlap with self) %is found, break out of loop if sum(k) > 2 break end end %set count bit corresponding to overlap with self back to '0' k((end_in-1)*length(walls)+wall)=0; %if an intersection exists if sum(k) %This section of code determines the orientation, relative to an %incident signal path, of a corner formed by two walls with overlapping %ends. Diffraction will ot occur at corners to which the path is %incident on the inside. end_1 = end_in; end_2 = 1+(find(squeeze(k),1)>length(walls)); wall_1_1 = walls(wall,1+2*(end_1-1):2+2*(end_1-1)); wall_1_2 = walls(wall,3-2*(end_1-1):4-2*(end_1-1)); wall_1_d = [wall_1_1(1) - wall_1_2(1) wall_1_1(2) - wall_1_2(2)]; wall_1_l = sum((wall_1_1-wall_1_2).^2)^.5; wall_1_test = wall_1_1-(1/Res).*wall_1_d./wall_1_l; wall_2_1 = walls(mod(find(k,1)-1,length(walls))+1, ... 1+2*(end_2-1):2+2*(end_2-1)); wall_2_2 = walls(mod(find(k,1)-1,length(walls))+1, ... 3-2*(end_2-1):4-2*(end_2-1)); wall_2_d = [wall_2_1(1) - wall_2_2(1) wall_2_1(2) - wall_2_2(2)]; wall_2_l = sum((wall_2_1-wall_2_2).^2)^.5; wall_2_test = wall_2_1-(1/Res).*wall_2_d./wall_2_l; dist_1_1 = sum((wall_1_1-wap_xy).^2)^.5; dist_1_test = sum((wall_1_test-wap_xy).^2)^.5; dist_2_1 = sum((wall_2_1-wap_xy).^2)^.5; dist_2_test = sum((wall_2_test-wap_xy).^2)^.5; away_1 = (dist_1_test > dist_1_1); away_2 = (dist_2_test > dist_2_1); if ~xor(away_1,away_2) is = 0; end %otherwise, check for 'T' shaped intersections that will prevent %diffraction else for i = 1:length(walls) d1=((walls(i,1)-walls(wall,1+2*(end_in1)))^2+(walls(i,2) ... -walls(wall,2+2*(end_in-1)))^2)^.5; d2=((walls(i,3)-walls(wall,1+2*(end_in-1)))^2+(walls(i,4) ... -walls(wall,2+2*(end_in-1)))^2)^.5; wall_length=((walls(i,1)-walls(i,3))^2+ ... (walls(i,2)-walls(i,4))^2)^.5; if ((d1+d2) == wall_length) && (i ~= wall) is = 0; break end end end %if no conditions found that prevent diffraction if is == 1 %append location of corner to list of corners and return diffract = [diffract; walls(wall,1+2*(end_in-1):2+2*(end_in-1))]; end return down_sample.m %This function downsamples an array of predicted values to a size that is %computationally appropriate for manipulation on the HTC Hero function [y1 y2] = down_sample(x) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %x oversampled array to be reduced %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %filtering array for use in averaging; oversampled points that map to %multiple daownsampled points are weighted lower for each use remap = [1 2 2 2 1; ... 2 4 4 4 2; ... 2 4 4 4 2; ... 2 4 4 4 2; ... 1 2 2 2 1]; %for each element of the desired downsampled array for i = 1:round(size(x,1)/2)/2 for j = 1:round(size(x,2)/2)/2 if 4*i-3 < size(x,1) && 4*j-3 < size(x,2) y1(i,j) = x(4*i-3,4*j-3); end %create indexing array of coordinate to correctly apply filtering % array coordx_tmp = [4*i-5 4*i-4 4*i-3 4*i-2 4*i-1; ... 4*i-5 4*i-4 4*i-3 4*i-2 4*i-1; ... 4*i-5 4*i-4 4*i-3 4*i-2 4*i-1; ... 4*i-5 4*i-4 4*i-3 4*i-2 4*i-1; ... 4*i-5 4*i-4 4*i-3 4*i-2 4*i-1]; coordy_tmp = [4*j-5 4*j-5 4*j-5 4*j-5 4*j-5; ... 4*j-4 4*j-4 4*j-4 4*j-4 4*j-4; ... 4*j-3 4*j-3 4*j-3 4*j-3 4*j-3; ... 4*j-2 4*j-2 4*j-2 4*j-2 4*j-2; ... 4*j-1 4*j-1 4*j-1 4*j-1 4*j-1]; %only use indices for which elements exist coordx = coordx_tmp(coordx_tmp>0 & coordx_tmp<=size(x,1) ... & coordy_tmp>0 & coordy_tmp<=size(x,2)); coordy = coordy_tmp(coordx_tmp>0 & coordx_tmp<=size(x,1) ... & coordy_tmp>0 & coordy_tmp<=size(x,2)); x_rel = diag(x(coordx,coordy)); %collect relevant signal strength values remap_rel = remap(coordx_tmp>0 & coordx_tmp<=size(x,1) ... & coordy_tmp>0 & coordy_tmp<=size(x,2)); %perform weighted average using relative remap array elements y2(i,j) = sum(sum(x_rel.*remap_rel))/sum(sum(remap_rel)); end end return SS_plot.m %This function plots the output of the propagation simulation function function SS_plot(building_size,wall_list,RSS,diffracted) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %building_size dimensions of building being modeled %wall_list list of wall elements used to plot building layout %RSS array of predicted received signal strength values %diffracted list of coordinate of corners at which diffraction was % modeled %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %open a new figure figure %in the right subplot, plot the predicted RSS values subplot(1,2,2) imagesc(0:.1:building_size(2),0:.1:building_size(1),RSS); title('RSS (dBm)') xlabel('meters') ylabel('meters') grid off,axis tight,axis equal,axis vis3d,view([0 90]),zoom(1),colorbar,axis xy axis([min([wall_list(:,2) ; wall_list(:,4)]) ... max([wall_list(:,2) ; wall_list(:,4)]) ... min([wall_list(:,1) ; wall_list(:,3)]) ... max([wall_list(:,1) ; wall_list(:,3)])]) %in the left subplot, plot the building layout includig walls, WAP % location, and location of corners for which diffraction was modeled subplot(1,2,1) title('Floor Plan') xlabel('meters') ylabel('meters') axis line([wall_list(:,2) tight,zoom(1) wall_list(:,4)]',[wall_list(:,1) wall_list(:,3)]','color','b') equal,axis axis([min([wall_list(:,2) ; wall_list(:,4)]) ... max([wall_list(:,2) ; wall_list(:,4)]) ... min([wall_list(:,1) ; wall_list(:,3)]) ... max([wall_list(:,1) ; wall_list(:,3)])]) axis xy hold on plot(diffracted(2:end,2),diffracted(2:end,1),'og') 'xr') plot(diffracted(1,2),diffracted(1,1), 因篇幅问题不能全部显示,请点此查看更多更全内容