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?

1 vue (au cours des 30 derniers jours)
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

Réponses (1)

Mathieu NOE
Mathieu NOE le 15 Avr 2024
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 commentaires
Pradipta Panchadhyayee
Pradipta Panchadhyayee le 19 Avr 2024
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 le 19 Avr 2024
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

Connectez-vous pour commenter.

Catégories

En savoir plus sur Blue dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by