% SUpDEq - Spatial Upsampling by Directional Equalization function supdeq_plotGrid( samplingGrid ) This function plots the spatial sampling grid on a sphere and on a 2D map Output: Figure Input: samplingGrid - Spatial sampling grid (Q x 2 matrix), where the first column holds the azimuth and the second the elevation (both in degree). Azimuth in degree (0=front, 90=left, 180=back, 270=right) (0 points to positive x-axis, 90 to positive y-axis) Elevations in degree (0=North Pole, 90=front, 180=South Pole) (0 points to positive z-axis, 180 to negative z-axis) plotMode - 'default' or 'gray', 'gray' is independent on sample size and delivers no map plot Default: 'default' Dependencies: - (C) 2018 by JMA, Johannes M. Arend TH Köln - University of Applied Sciences Institute of Communications Engineering Department of Acoustics and Audio Signal Processing
0001 %% SUpDEq - Spatial Upsampling by Directional Equalization 0002 % 0003 % function supdeq_plotGrid( samplingGrid ) 0004 % 0005 % This function plots the spatial sampling grid on a sphere and on a 2D map 0006 % 0007 % Output: 0008 % Figure 0009 % 0010 % Input: 0011 % samplingGrid - Spatial sampling grid (Q x 2 matrix), where the first 0012 % column holds the azimuth and the second the 0013 % elevation (both in degree). 0014 % Azimuth in degree (0=front, 90=left, 180=back, 270=right) 0015 % (0 points to positive x-axis, 90 to positive y-axis) 0016 % Elevations in degree (0=North Pole, 90=front, 180=South Pole) 0017 % (0 points to positive z-axis, 180 to negative z-axis) 0018 % plotMode - 'default' or 'gray', 'gray' is independent on sample size 0019 % and delivers no map plot 0020 % Default: 'default' 0021 % 0022 % Dependencies: - 0023 % 0024 % (C) 2018 by JMA, Johannes M. Arend 0025 % TH Köln - University of Applied Sciences 0026 % Institute of Communications Engineering 0027 % Department of Acoustics and Audio Signal Processing 0028 0029 %% 0030 function supdeq_plotGrid ( samplingGrid, plotMode ) 0031 0032 if nargin < 2 0033 plotMode = 'default'; 0034 end 0035 0036 samplingGridRad(:,1) = samplingGrid(:,1) * pi / 180; 0037 samplingGridRad(:,2) = samplingGrid(:,2) * pi / 180; 0038 [Xm,Ym,Zm]=sph2cart(samplingGridRad(:,1),pi/2-samplingGridRad(:,2),1.01); 0039 0040 0041 if strcmp(plotMode,'default') 0042 0043 figure %Sphere plot 0044 colormap Gray; 0045 if size(Xm,1)>1500 0046 plot3(Xm,Ym,Zm,'marker','.','markerfacecolor','g','color','g','linestyle','none') 0047 else 0048 plot3(Xm,Ym,Zm,'marker','o','markerfacecolor','g','color','g','linestyle','none') 0049 end 0050 0051 axis off; 0052 hold on; 0053 grid off; 0054 sphere; 0055 axis equal; 0056 rotate3d on; 0057 light; 0058 alpha(.8); 0059 lighting phong; 0060 camzoom(1.4); 0061 view(0,0) 0062 hold off; 0063 0064 figure %Map plot 0065 plot(samplingGrid(:,1),samplingGrid(:,2),'.') 0066 set(gca, 'YDir','reverse') 0067 xlim([-10 369]) 0068 ylim([-10 190]) 0069 xlabel('Azimuth [°]'); 0070 ylabel('Elevation [°]'); 0071 0072 elseif strcmp(plotMode,'gray') 0073 0074 %figure %Sphere plot 0075 colormap Gray; 0076 0077 plot3(Xm,Ym,Zm,'marker','o','markerfacecolor','k','color','k','linestyle','none','markersize', 1.5*8) 0078 0079 axis off; 0080 grid off; 0081 hold on; 0082 sphere; 0083 shading interp; 0084 axis equal; 0085 rotate3d off; 0086 %alpha(0.75); 0087 lighting gouraud; 0088 hold off; 0089 0090 end 0091 0092 0093 end 0094