How to plot a poincare beam showing its singularity using polarisation distribution plot

10 次查看(过去 30 天)
How to have a plot as shown in figure in MATLAB. It is polarization distribution with different C points in a poincare beam. Can anyone help me please

采纳的回答

William Rose
William Rose 2024-7-21
编辑:William Rose 2024-7-21
[Edit: Correct spelling mistakes and add comments to the code.]
It seems the green and black in your image represents one variable (beam intensity, perhaps), and the ellipses indicate direction and amount of polarization. Polarization at any point in the disk is described by two numbers: a=orientation of major axis (from 0 to 2Pi) and b=ratio of minor axis to major axis length (from 0 to 1).
Since you did not provide data, let us make up some data. Below I create beam intensity data on the X1,Y1 grid points, and I create ellipse orientation and ratio data on the X2,Y2 grid points.
% beam intensity data (simulated)
r1=0:.02:1; th1=0:pi/18:2*pi;
X1=r1'*cos(th1);
Y1=r1'*sin(th1);
intensr=sin(r1*pi); % intensity as a function of radius
intensth=ones(size(th1)); % intensity as a function of theta
IN =intensr'*intensth;
% beam polarization data (simulated)
[X2,Y2]=meshgrid(-1:.125:1,-1:.125:1);
a=(X2+Y2)*pi/2; % orientation of polarization ellipse
b=0.2+0.8*abs(X2/max(max(X2))); % ratio of semiminor to semimajor axis length
Next: Define a plotting function that will plot a white ellipse at a specified location, with the major axis in blue. This is to recreate ellipses like in the OP's plot.
function plotpolarz(x,y,r,a,b,z0)
% Inputs: x,y=ellipse center location, r=ellipse max radius
% a=angle of semimajor axis of the polarization ellipse (0 to 2Pi)
% b=ratio of semiminor to semimajor axis length (0 to 1)
% z0=z value, for plotting, so that ellipses are above the intensity surface
u=[cos(a),sin(a)]; % semimajor axis vector
v=b*[cos(a+pi/2),sin(a+pi/2)]; % semiminor axis vector
% elps=matrix of points on the ellipse (2 columns)
elps=r*(cosd(0:30:360)'*u+sind(0:30:360)'*v);
% next plot white ellipse
plot3(x+elps(:,1),y+elps(:,2),z0*ones(length(elps),1),'-w')
hold on
% next: plot semimajor axis, blue
plot3(x+r*[u(1),-u(1)],y+r*[u(2),-u(2)],z0*[1,1],'-b')
end
Next: Plot the intensity data and the polarization ellipses.
figure
surf(X1,Y1,IN,'EdgeColor','None')
xlabel('X'); ylabel('Y'); zlabel('Intensity')
colormap([zeros(101,1),(0:.01:1)',zeros(101,1)]) % color scale similar to the OP
view(0,90); axis equal; colorbar; hold on
% Plot polarization ellipses
[imax,jmax]=size(X2);
z0=max(max(IN));
for i=1:imax
for j=1:jmax
if X2(j,i)^2+Y2(j,i)^2<=1
plotpolarz(X2(j,i),Y2(j,i),0.04,a(j,i),b(j,i),z0)
end
end
end
Done.

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Polar Plots 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by