% % First, run getSensingMatrix to get a sensing matrix % % probeNames is a sensor matrix previously defined to run getSensingMatrix % cDrvNames is a DOF matrix previously defined to run getSensingMatrix % % function plot_radar_chart(sensMAT, probeNames, cDrvNames, saveplot) stitle = probeNames; sensnum = length(probeNames); DoF = cDrvNames; % color vector c = [0.97 0.1 0.0; 0.2 0.8 0.1; 0.1 0.9 1.0; 0.4 0.4 1.0; 0.0 0.0 0.0; 0.0 0.0 1.0]; fname = 'Times'; TITLE = cellstr(stitle); %% runs through all the radar charts. % make a big plot view scrsz = get(0,'ScreenSize'); figure('Position', [0 0 scrsz(3) scrsz(4)]) %% handles = zeros(length(DoF), 2); hsub = zeros(length(sensnum),1); for jj = 1:sensnum % adjust subplot configuration for the number of sensors. hsub(jj,:) = subplot(1,sensnum, jj); sensn = jj; % creates a radar chart with fake curves % this step is necesary to define the plot ranges % max_lim determines the ticks if sensn == 11 || sensn == 12 % ||sensn == 10 max_lim = 6; else max_lim = 10; end x_fake=[0 max_lim 0 -max_lim]; y_fake=[max_lim 0 -max_lim 0]; h_fake = compass(x_fake, y_fake); radar_handle(jj, 1) = gca; hold on set(gca,'YLimMode','Manual'); delete(findall(gcf, 'LineStyle', ':')); hold on ang=[0:1:360]; for r=0:max_lim if r == 3 linestr='-'; color=[0,0,0]; color=[0.5,0.5,0.5]; linew=1; elseif r == 6 linestr='-'; color=[0,0,0]; color=[0.5,0.5,0.5]; linew=1; elseif r == 9 linestr='-'; color=[0,0,0]; color=[0.5,0.5,0.5]; linew=1; else linestr='--'; color=[0.5,0.5,0.5]; linew=.5; end plot(r*cos(ang/180*pi),r*sin(ang/180*pi),linestr,'Color',color,'LineWidth',linew); end r=[-max_lim max_lim]; for ang=0:10:360-10 if mod(ang,30)==0 linestr='-'; color=[0,0,0]; color=[0.5,0.5,0.5]; linew=1; else linestr='--'; color=[0.5,0.5,0.5]; linew=.5; end plot(r*cos(ang/180*pi),r*sin(ang/180*pi),linestr,'Color',color,'LineWidth',linew); end % titles of eac chart htitles = title(TITLE(jj)); set(htitles, 'FontName', fname) set(htitles, 'FontSize', 20) for kk = 1:length(probeNames) % extract the data which is returned from "newSensMat.m" dum = sensMAT(sensn, kk); % break the data into the arrow length (ABS) and the angle (PHASE) ABS = log10(abs(dum)); if ABS<0 ABS = 0; end PHASE = angle(dum); z = [ABS*cos(PHASE) ABS*sin(PHASE)]; hold on; %h(kk,:) = compass(z(1), z(2)); %set(h(kk), 'Color', c(kk,:)) set(h_fake,'Visible','off'); % plot the arrows handles(kk,:) = plot_arrow(0,0,z(1), z(2), 'LineWidth',1.5, 'edgecolor', c(kk, :),... 'facecolor', c(kk, :), 'color', c(kk, :), 'headwidth',.5); % adjusting the TickLabels delete(findall(gcf, 'String', ' 2')); delete(findall(gcf, 'String', ' 4')); delete(findall(gcf, 'String', ' 5')); delete(findall(gcf, 'String', ' 6')); delete(findall(gcf, 'String', ' 8')); delete(findall(gcf, 'String', ' 10')); text(0.1, 3, '10^3 [W/m]','FontSize', 14, 'Color','b') text(0.1, 6, '10^6','FontSize', 14, 'Color','b') if max_lim == 10 text(0.1, 9, '10^9','FontSize', 14, 'Color','b') end set(findall(gcf, 'String', '330'),'String', [' 330']); % position of 330 set(findall(gcf, 'String', '30'),'String', [' 30']); % position of 30 set(findall(gcf, 'String', '300'),'String', [' 300']); % position of 300 set(findall(gcf, 'String', '180'),'String', ['180 ']); % position of 180 set(findall(gcf, 'String', '150'),'String', ['150 ']); % position of 30 set(findall(gcf, 'String', '210'),'String', ['210 ']); % position of 30 % adding the phase unit set(findall(gcf, 'String', '270'),'String', ['270 [deg]']); end hold off end %% Legends and Titles hlegend = legend(handles(1:length(DoF)), DoF); set(hlegend,'Position', [0.0129 0.1 0.0877 0.200]) set(hlegend,'FontName', fname, 'FontSize', 16) htitle = suptitle('Radar Sensing Matrix'); set(htitle, 'FontSize', 28) set(htitle, 'FontName', fname) % %% save as eps if saveplot grid minor orient landscape %set(gcf, 'Position', [1 1 1400 500]); %set(gcf, 'Position',[ 24 7 1150 400]); set(gcf,'PaperPositionMode','auto') print('-depsc','-r600', 'commissh_radar.eps') %print('-dpdf','-r600', 'commissh_radar.pdf') end