フィルターのクリア

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
Pradipta Panchadhyayee 2024 年 4 月 19 日
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 Center および File ExchangeWhite についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by