Create 2D radial symmetric matrix from radius vector

14 次查看(过去 30 天)
Hello, I have a following problem. I calculate intensity distribution Bessel-Gauss beam using Hankel transform. Input variables
f = 10000;
a = 10;
ff = 3.2;
w0 = ff * a;
lambda = 10^(-6);
k = 2 * pi / lambda;
N = 100;
rmax = 1.8 * lambda * f / a;
# observation plane
x1 = linspace(-rmax,rmax,N);
y1 = linspace(-rmax,rmax,N);
[U,V] = meshgrid(x1,y1);
W = sqrt(U.^2 + V.^2);
# aperture plane
xx = linspace(-a,a,N);
yy = linspace(-a,a,N);
[X,Y] = meshgrid(xx,yy);
R = sqrt(X.^2 + Y.^2);
Hankel transform:
A2 = zeros(N);
for i = 1:N
for j = 1:N
fun = besselj(0,k/f * W(i,j) * R) .* R .* exp(-(R/w0).^2);
A2(i,j) = trapz(y1,trapz(x1,fun));
end
end
A2 = abs(A2).^2;
imagesc(A2);
Output:
This method takes about 100 sec using N = 100. So for much beter resolution calculating takes a much more time. So I think that beter solution will be using 1D intensity distribution radius vector and create 2D matrix rotate in relation to the center. I dont find solution for that, so i created intensity distribution diameter vector and then i can use A' * A what i find in Matlab Answers. Need to change range from -a:a to 0:a and this same in rmax case. Code:
A = zeros(1,N);
for i = 1:N
fun = besselj(0,k/f * x1(i) * xx) .* xx .* exp(-(xx/w0).^2);
A(i) = trapz(fun);
end
A = [fliplr(A(2:end)) A];
A = abs(A).^2;
Output:
Using A = A' * A /2 I received:
My question: There is any option to improve radial symmetry in output image or maybe there is different method to create 2D matrix from vector?

回答(1 个)

Matt
Matt 2018-2-10
Hey! Just a thought... Does resizing the figure window help?

类别

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

Community Treasure Hunt

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

Start Hunting!

Translated by