Blame | Last modification | View Log | Download
function poincaresphere(I0,I45,I90,I135,Icr,Icl)
% COMPUTED PARAMETERS
%Stokes vectors
S0 = I0 + I90;
S1 = I0 - I90;
S2 = I45 - I135;
S3 = Icr - Icl;
P = sqrt( S1^2 + S2^2 + S3^2 ) / S0;
S = [S1 S2 S3]./S0;
fprintf('P = %f\n',P);
fprintf('S = (%f,%f,%f)\n',S(1),S(2),S(3));
% DRAWING SPHERE
% Sphere
[X Y Z] = sphere(20);
mesh(X,Y,Z,'edgecolor',[0.5 0.5 0.5]);
alpha(0.2);
axis equal;
hold on;
% DRAWING CIRCLES
% circle in Sx,Sy plane
t = 0:0.001:2*pi;
n = length(t);
Kx = cos(t);
Ky = sin(t);
Kz = zeros(n,1);
plot3(Kx,Ky,Kz,'LineWidth',2);
% circle Sy,Sz plane
Kx = zeros(n,1);
Ky = cos(t);
Kz = sin(t);
plot3(Kx,Ky,Kz,'LineWidth',2);
% circle in Sx,Sz plane
Kx = cos(t);
Ky = zeros(n,1);
Kz = sin(t);
plot3(Kx,Ky,Kz,'LineWidth',2);
% DRAWING AXES
% axis connecting 135 and 45
x = [0 0];
y = [-1.3 1.3];
z = [0 0];
plot3(x,y,z,'LineWidth',2,'Color',[0 1 0]);
text(0,1.4,0,'+S_y (45 st.)');
text(0,-1.4,0,'-S_y (135 st.)');
% axis connecting 0 and 90
x = [1.3 -1.3];
y = [0 0];
z = [0 0];
plot3(x,y,z,'LineWidth',2,'Color',[0 1 0]);
text(1.4,0,0,'+S_x (0 st.)');
text(-1.4,0,0,'-S_x (90 st.');
% axis connecting CR and CL
x = [0 0];
y = [0 0];
z = [1.3 -1.3];
plot3(x,y,z,'LineWidth',2,'Color',[0 1 0]);
text(0,0,1.4,'+S_z (CR)');
text(0,0,-1.4,'-S_z (LR)');
% plot Poincare vector
quiver3(0,0,0,S(1),S(2),S(3),'Color',[1 0 0],'LineWidth',3,'MaxHeadsize',6);
s = ['S = ' '(' num2str(S(1),'%1.3f') ', ' num2str(S(2),'%1.3f') ', ' num2str(S(3),'%1.3f') ')'];
m = sqrt( S(1)^2 + S(2)^2 + S(3)^2 );
P = [S(1)/m S(2)/m S(3)/m];
text(P(1)+0.1,P(2)+0.1,P(3)+0.1,s);
plot3(P(1),P(2),P(3),'r.','MarkerSize',25);