generates city model with buildings INPUT nrx number of buldings in x axe nry number of buldings in y axe w_build width of the buildings w_street width of the streets style plot style (as in regular plot function) OUTPUT fig plot of the buildings and street $Id: mk_sqr_net.m,v 1.1 2004/05/12 16:22:59 dalai Exp $
0001 % generates city model with buildings 0002 % 0003 % INPUT 0004 % nrx number of buldings in x axe 0005 % nry number of buldings in y axe 0006 % w_build width of the buildings 0007 % w_street width of the streets 0008 % style plot style (as in regular plot function) 0009 % 0010 % OUTPUT 0011 % fig plot of the buildings and street 0012 % 0013 % 0014 % $Id: mk_sqr_net.m,v 1.1 2004/05/12 16:22:59 dalai Exp $ 0015 0016 function mk_sqr_net(nrx,nry,w_build,w_street,style) 0017 0018 % length in metres taken from the ETSI UMTS spec. 0019 % w_build = 200; 0020 % length in metres taken from the ETSI UMTS spec. 0021 % w_street = 50; 0022 0023 % logical to fill the blocks with color style 0024 isfill = false; 0025 0026 lattice_cell = w_build + w_street; 0027 0028 hold on; 0029 axis(1/2*lattice_cell.*[-nrx nrx -nry nry]); 0030 z = lattice_cell.*((ones(nry,1)*((1:nrx)-(nrx+1)/2)) + i*(((1:nry)-(nry+1)/2)'*ones(1,nrx))); 0031 for j=1:nry 0032 for k=1:nrx 0033 if (j==1) || (j==nry) || (k==1) || (k==nrx) 0034 mk_sqr(z(j,k),w_build,'--k',isfill); 0035 else 0036 mk_sqr(z(j,k),w_build,style,isfill); 0037 end 0038 end 0039 end 0040 0041 hold off; 0042