I want to increase the distance, the dimensions of the viewing screen should be such that all the beams are on the screen while the pixel value is fixed. How is this possible?
4 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Hi
Look at this code:
close all; clear; clc
N = 2560;
L = 1e4;
dx = 4e-3;
[x0,y0] = meshgrid((-N/2:N/2-1)*dx);
[xL,yL] = meshgrid((-N/2:N/2-1)*dx);
[fx,fy] = meshgrid((-N/2:N/2-1)/(N*dx));
Ni = 37; % Number of beams
d= 25e-2;
a= pi./3;
xi= [ 0 , - d , - d.*cos(a) ,d.*cos(a),d ,d.*cos(a), -d.*cos(a)...
,-2.*d , -2.*d.*cos(a), 0,2.*d.*cos(a), 2.*d, 2.*d.*cos(a),0 , -2.*d.*cos(a)...
, -d-d.*cos(a), d+d.*cos(a), d+d.*cos(a) , -d-d.*cos(a)...
, 3.*d.*cos(a),3.*d.*cos(a)-d, -3.*d.*cos(a)+d , -3.*d.*cos(a), 2.*d.*cos(a)+d,3.*d.*cos(a)+d...
3.*d,3.*d.*cos(a)+d, 2.*d.*cos(a)+d, 3.*d.*cos(a),3.*d.*cos(a)-d, -3.*d.*cos(a)+d , -3.*d.*cos(a)...
,-2.*d.*cos(a)-d ,-3.*d.*cos(a)-d , - 3.*d ,-2.*d.*cos(a)-d ,-3.*d.*cos(a)-d] ;
yi= [ 0 , 0 , d.*sin(a),d.*sin(a), 0 , -d.*sin(a), -d.*sin(a)...
,0 , 2.*d.*sin(a), 2.*d.*sin(a),2.*d.*sin(a), 0 , - 2.*d.*sin(a), -2.*d.*sin(a)...
, - 2.*d.*sin(a), d.*sin(a),d.*sin(a), -d.*sin(a),-d.*sin(a)...
, 3.*d.*sin(a),3.*d.*sin(a),3.*d.*sin(a),3.*d.*sin(a), 2.*d.*sin(a),d.*sin(a), 0 ...
, -d.*sin(a), -2.*d.*sin(a), -3.*d.*sin(a), -3.*d.*sin(a), -3.*d.*sin(a),-3.*d.*sin(a)...
,2.*d.*sin(a), d.*sin(a), 0 , -2.*d.*sin(a), -d.*sin(a)];
w0 = 10e-2;
P = 1e3;
lambda = 1080e-9; k = 2*pi/lambda;
L0= 10; l0= 5e-3;
kL= 2.*pi./L0; kl= 5.92./l0;
Cn2= randi([1 1000],1,60)*1e-16;
Kx = 2.*pi.*fx; Ky = 2.*pi.*fy;
U0= 0*x0;
for idx=1:Ni
Utemp = U0 + sqrt(2.*P./pi)./w0 .* exp(-((x0-xi(idx)).^2+(y0-yi(idx)).^2)./w0.^2);
Utemp(((x0-xi(idx)).^2+(y0-yi(idx)).^2)>w0.^2) = 0;
U0= U0 + Utemp;
end
Ui=U0;
figure(1000)
s = pcolor(x0, y0, abs(Ui));
s.EdgeColor = 'none';
title("0^{th} Intenesity screen")
xlabel 'X [m] '
ylabel 'Y [m] '
cbar = colorbar;
cbar.Label.String = 'Intensity(X, Y, 0) [W/cm^2]';
ax = gca;
axis square
ax.FontName = 'Times new roman';
ax.FontSize = 15;
Ni=60; % Number of page views
for idx = 1:Ni
r0= (0.423 .* k.^2 .* Cn2(idx).*L )^(-3/5);
phi = 0.023*r0.^2^(-3./5)*exp(-((Kx^2 + Ky^2) ./ kl.^2)) .* ((Kx.^2 + Ky.^2 + kL^2) ./ (4*pi^2)).^(-11./6);
sigma= 1./(N*dx).*sqrt(phi);
c = randn(N) + i*randn(N);
random_sigma= c.* sigma;
random_sigma(N./2+1,N./2+1)=0;
phi_xy = real(ifftshift(ifft2(ifftshift(random_sigma)))) / dx^2;
Hf = exp(i*k*L).* exp(-i*pi*lambda*L*(fx.^2+fy.^2));
G = fftshift(fft2(fftshift(Ui))) * dx^2;
Ui = ifftshift(ifft2(ifftshift(G.*Hf))) / dx^2;
Ui = Ui .* exp(1i*phi_xy);
figure(2*idx-1)
s = pcolor(x0, y0, phi_xy);
s.EdgeColor = 'none';
title(num2str(idx)+"^{th} phase screen")
xlabel 'X [m]'
ylabel 'Y [m]'
cbar = colorbar;
cbar.Label.String = 'Intensity(X, Y, 0) [W/cm^2]';
ax = gca;
axis square
ax.FontName = 'Times new roman';
ax.FontSize = 15;
figure(2*idx)
s = pcolor(xL, yL, abs(Ui));
title(num2str(idx)+"^{th} Intenesity screen")
s.EdgeColor = 'none';
xlabel 'X [m] '
ylabel 'Y [m] '
cbar = colorbar;
cbar.Label.String = 'Intensity(X, Y, 0) [W/cm^2]';
ax = gca;
axis square
ax.FontName = 'Times new roman';
ax.FontSize = 15;
end
In order to see the result at any desired distance (in this code up to L = 1e 4), I have to change the number of pixels (N) according to the desired distance so that all the beams are on the viewing screen.
Now I want the code to be in such a way that by increasing the distance and keeping the number of pixels (512) constant, the dimensions of the viewing screen can accommodate all the beams.
On the other hand, I want to reduce the running time of the code.
How is this possible?
0 commentaires
Réponses (0)
Voir également
Catégories
En savoir plus sur Red 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!