how to plot the state of polarisation distribution of a c or v point polarisation singularity using quiver plots
8 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Aswathi K
am 23 Mai 2024
Kommentiert: Aswathi K
am 29 Mai 2024
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1702051/image.png)
Akzeptierte Antwort
Milan Bansal
am 28 Mai 2024
Bearbeitet: Milan Bansal
am 29 Mai 2024
Hi Aswathi K,
I understand that you want to plot the ellipses as shown in the image using the quiver plot for a c-point or v-point polarization singularity.
The quiver plot in MATLAB plots arrows with specified directional components at the specified Cartesian coordinates. It cannot plot the directional ellipses. However, for a workaround, you can refer to the following steps and the code snippet given below to plot the ellipses for a c-point polarization singularity:
- Define the grid: Create a grid of points where you want to plot the polarization ellipses.
- Calculate the ellipse parameters: For each point on the grid, calculate the parameters of the polarization ellipse (orientation, major and minor axes).
- Plot the ellipses: Use the plot function to draw ellipses at each grid point.
% Define the grid
[x, y] = meshgrid(-10:1:10, -10:1:10);
% Radius of the circular region
R = 10;
% Create a figure
figure;
hold on;
axis equal;
axis off;
% Define the number of points for plotting ellipses
num_points = 50;
t = linspace(0, 2*pi, num_points);
% Loop through each grid point
for i = 1:numel(x)
% Coordinates
xi = x(i);
yi = y(i);
% Only plot ellipses within the circular region
if sqrt(xi^2 + yi^2) <= R
theta = atan2(yi, xi) / 2; % Orientation of the ellipse
a = 1 - 0.05 * sqrt(xi^2 + yi^2); % Major axis length
b = 0.2 * abs(sin(2*theta)); % Minor axis length
% Parametric equation of the ellipse
X = a * cos(t);
Y = b * sin(t);
% Rotate the ellipse by angle theta
R_matrix = [cos(theta) -sin(theta); sin(theta) cos(theta)];
ellipse = R_matrix * [X; Y];
% Plot the ellipse at the point (xi, yi)
plot(xi + ellipse(1, :), yi + ellipse(2, :), 'r', 'LineWidth', 1);
end
end
% Plot the circular boundary
theta_boundary = linspace(0, 2*pi, num_points);
plot(R * cos(theta_boundary), R * sin(theta_boundary), 'k', 'LineWidth', 2);
Please refer to the following documentation link to learn more about quiver function.
Hope this helps!
3 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Vector Fields finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!