How can I get more divisions in x- and y- axes scaling when plotting with imagesc to have a clear picture and introduce the proper scaling along x- & y- axes?

2 次查看(过去 30 天)
clc;
[x,y] = meshgrid(linspace(-0.6, 0.6), linspace(-0.6, 0.6));
[phi,r] = cart2pol(x,y);
% Omega_r -vortex beam specification
l = 2;
p = 2;
w0 = 0.2;
R = sqrt(2).*r./w0;
RR = r./w0;
Omega01 = exp(-RR.^2);
Lpl = 0;
for m = 0:p;
Lpl = Lpl + (((-1).^m)./factorial(m)).*nchoosek(p+l,p-m).*(R.^(2.*m));
end;
Omega_r = Omega01.*(RR.^(abs(l))).*Lpl.*exp(-i.*l.*phi);
figure;
imagesc(angle(Omega_r));
colormap jet
colorbar

回答(1 个)

Mathieu NOE
Mathieu NOE 2024-4-15
hello
simply specify the number of points when you call linspace
here I introduced N = 500 (N = 100 by default)
N = 500;
[x,y] = meshgrid(linspace(-0.6, 0.6 ,N), linspace(-0.6, 0.6 ,N));
[phi,r] = cart2pol(x,y);
% Omega_r -vortex beam specification
l = 2;
p = 2;
w0 = 0.2;
R = sqrt(2).*r./w0;
RR = r./w0;
Omega01 = exp(-RR.^2);
Lpl = 0;
for m = 0:p
Lpl = Lpl + (((-1).^m)./factorial(m)).*nchoosek(p+l,p-m).*(R.^(2.*m));
end
Omega_r = Omega01.*(RR.^(abs(l))).*Lpl.*exp(-1i.*l.*phi);
figure;
imagesc(angle(Omega_r));
colormap jet
colorbar
axis square
  2 个评论
Pradipta Panchadhyayee
Thanks for your response. I had this kind of plot by inserting the option of number of divisions. But I was unable to change the x-axis and y-axis scalings (-0.6 to 0.6). Still this problem persists. This is not resolved.
Mathieu NOE
Mathieu NOE 2024-4-19
try this
you need to create x and y vectors (before the meshgrid call) - that will be used latter as arguments to pass to imagesc
now your axes are displayed with -0.6 / + 0.6 range
N = 500;
x = linspace(-0.6, 0.6 ,N);
y = linspace(-0.6, 0.6 ,N);
[X,Y] = meshgrid(x,y);
[phi,r] = cart2pol(X,Y);
% Omega_r -vortex beam specification
l = 2;
p = 2;
w0 = 0.2;
R = sqrt(2).*r./w0;
RR = r./w0;
Omega01 = exp(-RR.^2);
Lpl = 0;
for m = 0:p
Lpl = Lpl + (((-1).^m)./factorial(m)).*nchoosek(p+l,p-m).*(R.^(2.*m));
end
Omega_r = Omega01.*(RR.^(abs(l))).*Lpl.*exp(-1i.*l.*phi);
figure;
imagesc(x,y,angle(Omega_r));
colormap jet
colorbar
axis square

请先登录,再进行评论。

类别

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

Community Treasure Hunt

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

Start Hunting!

Translated by