Home > SPlaC v1_0 > Mie > DIP > DipPlotEfarAllP.m

DipPlotEfarAllP

PURPOSE ^

Plots typical dipole radiation profiles for a few wavelengths

SYNOPSIS ^

function DipPlotEfarAllP(stEfarAllP, lambda0)

DESCRIPTION ^

 Plots typical dipole radiation profiles for a few wavelengths
 These are plotted for typical cases (perpendicular,
 parrallel, and oblique dipoles)
 as theta dependent functions for a fixed phi (0 or pi/2).
 For phi=0 (i.e. plot in xOz),
 the dipole arrow is shown on the plot.

 Parameters:
 - stEfarScaAllP: obtained from DipFarFieldAllP
 - lambda0: scalar or vector (short vector otherwise plot would be messy)
            wavelength(s) in nm for which the plots are done

 This file is part of the SPlaC v1.0 package (copyright 2008)
 Check the README file for further information

EXAMPLE OF OUTPUT ^

Example figure output

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 lambda=stEfarAllP.lambda;
0002 theta=stEfarAllP.theta;
0003 nNbTheta=length(theta);
0004 indNegTheta=length(theta):-1:2;
0005 indAllTheta=[indNegTheta,1:length(theta)];
0006 thetaAll=[-theta(indNegTheta), theta];
0007 
0008 sLegend=cell(1,length(lambda0));
0009 MdRadParaPhi0=zeros(length(lambda0),nNbTheta);
0010 MdRadParaPhi90=zeros(length(lambda0),nNbTheta);
0011 MdRadPerpAllPhi=zeros(length(lambda0),nNbTheta);
0012 MdRadPxPzPhi0=zeros(length(lambda0),nNbTheta);
0013 MdRadPxPzPhi180=zeros(length(lambda0),nNbTheta);
0014 MdMaxParaPhi0=0;
0015 MdMaxParaPhi90=0;
0016 MdMaxPerpAllPhi=0;
0017 MdMaxPxPzPhi0=0;
0018 
0019 for ll=1:length(lambda0)
0020     ind=find(lambda==lambda0(ll),1);
0021     if isempty(ind)
0022         disp(['DipPlotEfarAllP: lambda=' num2str(lambda0(ll)) ...
0023             ' cannot be found. Using lambda=' num2str(lambda(1)) ' instead']);
0024         ind=1;
0025     end
0026     % theta-dependent MdRadPerp
0027     MdRadPerpAllPhi(ll,:)=stEfarAllP.MdRadPerpAllPhi(ind,:);
0028     MdMaxPerpAllPhi=max(MdMaxPerpAllPhi,max(MdRadPerpAllPhi(ll,:))); % find limits for axis scale
0029     % theta-dependent MdRadParaPhi0
0030     MdRadParaPhi0(ll,:)=stEfarAllP.MdRadParaPhi0(ind,:);
0031     MdMaxParaPhi0=max(MdMaxParaPhi0,max(MdRadParaPhi0(ll,:))); % find limits for axis scale
0032     % theta-dependent MdRadParaPhi90
0033     MdRadParaPhi90(ll,:)=stEfarAllP.MdRadParaPhi90(ind,:);;
0034     MdMaxParaPhi90=max(MdMaxParaPhi90,max(MdRadParaPhi90(ll,:))); % find limits for axis scale
0035     % theta-dependent MdRad at Phi=0 for px=pz
0036     % note that the symmetry around the z axis is lost in this case
0037     % For theta<0, the value must be obtained from |theta| and phi=pi, i.e.
0038     MdRadPxPzPhi0(ll,:)=8*pi/3*1/2*( ...
0039         abs(stEfarAllP.Ecr(ind,:)+stEfarAllP.Em0r(ind,:)).^2+ ...
0040         abs(stEfarAllP.Ect(ind,:)+stEfarAllP.Em0t(ind,:)).^2 );
0041     MdMaxPxPzPhi0=max(MdMaxPxPzPhi0,max(MdRadPxPzPhi0(ll,:))); % find limits for axis scale
0042     MdRadPxPzPhi180(ll,:)=8*pi/3*1/2*( ...
0043         abs(-stEfarAllP.Ecr(ind,:)+stEfarAllP.Em0r(ind,:)).^2+ ...
0044         abs(-stEfarAllP.Ect(ind,:)+stEfarAllP.Em0t(ind,:)).^2 );
0045     MdMaxPxPzPhi0=max(MdMaxPxPzPhi0,max(MdRadPxPzPhi180(ll,:))); % find limits for axis scale
0046     % prepare legend for figure
0047     sLegend{ll}=['\lambda=' num2str(lambda(ind)) 'nm'];
0048 end
0049 
0050 % define four colors
0051 scol='brgm';
0052 
0053 % create, position, and resize figure
0054 scrsz = get(0,'ScreenSize'); % scrsz(4) contains screen height
0055 figAspectRatio=1;
0056 figHeight=scrsz(4)-150;
0057 figWidth=figAspectRatio*figHeight;
0058 figure('Name','Radiation profiles', ...
0059     'Position',[(scrsz(3)-figWidth)/2 50 figWidth figHeight]);
0060 
0061 % length of dipole arrow in relative units
0062 plength=0.6;
0063 
0064 hpl1=subplot(2,2,1);
0065 set(hpl1,'Outerposition',[0,0.5,0.5,0.5]);
0066 
0067 h = polar([0 2*pi], [0 MdMaxParaPhi0]);
0068 delete(h);
0069 hold on;
0070 for ll=1:length(lambda0)
0071     polar(thetaAll,MdRadParaPhi0(ll,indAllTheta),scol(1+mod(ll-1,4)));
0072 end
0073 quiver(0,-plength/2*MdMaxParaPhi0,0,plength*MdMaxParaPhi0,'Color',[0.5;0;0.5],'LineWidth',1.5,'MaxHeadSize',0.8);
0074 rectangle('Position',MdMaxParaPhi0*[-0.5,-0.1,0.2,0.2],'Curvature',[1,1],...
0075           'FaceColor',[0.8 0.8 0.8]);
0076 hold off;
0077 title('M^{d-Para}_{Rad}(\theta, \phi=0)');
0078 xlabel('Theta [degrees]'); ylabel('M^d_{Rad}');
0079 legend(sLegend,'Location','NorthEastOutside');
0080 
0081 hpl2=subplot(2,2,2);
0082 set(hpl2,'Outerposition',[0.5,0.5,0.5,0.5]);
0083 h = polar([0 2*pi], [0 MdMaxParaPhi90]);
0084 delete(h);
0085 hold on;
0086 for ll=1:length(lambda0)
0087     polar(thetaAll,MdRadParaPhi90(ll,indAllTheta),scol(1+mod(ll-1,4)));
0088 end
0089 % dipole is perpendicular to plane of figure here
0090 quiver(0,0,0,0,'Color',[0.5;0;0.5],'LineWidth',1.5,'MaxHeadSize',0.8);
0091 rectangle('Position',MdMaxParaPhi90*[-0.5,-0.1,0.2,0.2],'Curvature',[1,1],...
0092           'FaceColor',[0.8 0.8 0.8]);
0093 hold off;
0094 title('M^{d-Para}_{Rad}(\theta, \phi=90^\circ)');
0095 %xlabel('Theta [degrees]'); ylabel('M^d_{Rad}');
0096 legend(sLegend,'Location','NorthEastOutside');
0097 
0098 hpl3=subplot(2,2,3);
0099 set(hpl3,'Outerposition',[0,0,0.5,0.5]);
0100 h = polar([0 2*pi], [0 MdMaxPerpAllPhi]);
0101 delete(h);
0102 hold on;
0103 for ll=1:length(lambda0)
0104     polar(thetaAll,MdRadPerpAllPhi(ll,indAllTheta),scol(1+mod(ll-1,4)));
0105 end
0106 quiver(-plength/2*MdMaxPerpAllPhi,0,plength*MdMaxPerpAllPhi,0,'Color',[0.5;0;0.5],'LineWidth',1.5,'MaxHeadSize',0.8);
0107 rectangle('Position',MdMaxPerpAllPhi*[-0.5,-0.1,0.2,0.2],'Curvature',[1,1],...
0108           'FaceColor',[0.8 0.8 0.8]);
0109 hold off;
0110 title('M^{d-Perp}_{Rad}(\theta) (\phi-independent)');
0111 %xlabel('Theta [degrees]'); ylabel('M^d_{Rad}');
0112 legend(sLegend,'Location','NorthEastOutside');
0113 
0114 hpl4=subplot(2,2,4);
0115 set(hpl4,'Outerposition',[0.5,0,0.5,0.5]);
0116 h = polar([0 2*pi], [0 MdMaxPxPzPhi0]);
0117 delete(h);
0118 hold on;
0119 for ll=1:length(lambda0)
0120     % note that the symmetry around the z axis is lost in this case
0121     % For theta<0, the value must be obtained from |theta| and phi=pi, i.e.
0122     polar(thetaAll,[MdRadPxPzPhi180(ll,indNegTheta), MdRadPxPzPhi0(ll,1:length(theta))],scol(1+mod(ll-1,4)));
0123 end
0124 quiver(-plength/sqrt(8)*MdMaxPxPzPhi0,-plength/sqrt(8)*MdMaxPxPzPhi0, ...
0125     plength/sqrt(2)*MdMaxPxPzPhi0,plength/sqrt(2)*MdMaxPxPzPhi0,'Color',[0.5;0;0.5],'LineWidth',1.5,'MaxHeadSize',0.8);
0126 rectangle('Position',MdMaxPxPzPhi0*[-0.5,-0.1,0.2,0.2],'Curvature',[1,1],...
0127           'FaceColor',[0.8 0.8 0.8]);
0128 hold off;
0129 title('M^{d-(p_x=p_z)}_{Rad}(\theta,\phi=0,180^\circ)');
0130 %xlabel('Theta [degrees]'); ylabel('M^d_{Rad}');
0131 legend(sLegend,'Location','NorthEastOutside');

This web page is part of the SPlaC package © 2008. Contact: Eric Le Ru
Generated on Wed 03-Dec-2008 11:10:14 by m2html © 2003 (adapted)