why I'm not getting any output here and what should I do in my program?
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
clear
clc
lambda=1064*1E-9;
k = 2*pi/lambda;
Lx = 0.00864;
screen_rad = Lx/2;
pixel=Lx/1080;
Xline=-screen_rad:pixel:screen_rad-pixel;
Yline=-screen_rad:pixel:screen_rad-pixel;
dim_screen=2*screen_rad;
[X,Y]=meshgrid(Xline,Yline);
r=sqrt(X.^2 + Y.^2);
phi=atan2(Y,X);
ph = ones(1,20).*(1);
N=20;
wd=15*pixel;
m=1;
d=6.5*wd;
a=d/sqrt(2*(1-cos(2*pi/N))); % Radius
E=zeros(size(X));
inphase=0;
for j=1:N
theta(j) = pi*(2*(j)-1)/N;
alpha(j) = a*cos(theta(j));
beta(j) = a*sin(theta(j));
num = ((X - alpha(j)).^2 + (Y - beta(j)).^2);
den = 2*(wd^2);
E = E + exp(-num./den).*((cos(ph(j))+1i*sin((ph(j))))); % Discrete vortexexp(1i*ph(j));
end
H1 = cos(ph);
H2 = sin(ph);
figure(1)
% I think it's due to gradient, then what shoul I use to get arrows at a
% single direction
DEx = gradient(H1);
DEy = gradient(H2);
quiver(H1,H2,DEx,DEy,"LineWidth",1,"Color",'k')
function phaseRGB=phaseRGBconverter(I)
res=360;
A=hsv(res);
phase=ceil((res-1)*(0.5+angle(I)/(2*pi)));
phase(phase==0)=res;
NUn=(abs(I))./max(abs(I(:)));
phaseRGB(:,:,1)=reshape(A(phase,1),size(phase)).*(NUn);%+(1-NUn)/4;
phaseRGB(:,:,2)=reshape(A(phase,2),size(phase)).*(NUn);%+(1-NUn)/4;
phaseRGB(:,:,3)=reshape(A(phase,3),size(phase)).*(NUn);%+(1-NUn)/4;
end
0 comentarios
Respuestas (1)
Image Analyst
el 23 de Feb. de 2023
ph is all zeros. That mistake is the source of all your problems.
Ver también
Categorías
Más información sobre Geometric Transformation and Image Registration en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!