Matlab logic of plotting meshgrid formula

조회 수: 2 (최근 30일)
fima v
fima v 2024년 4월 24일
답변: Steven Lord 2024년 4월 24일
There is a code which uses meshgrid which is basicly doing all combination of one vector with the size of the other vector and visa versa. y and z are values of the field in the Y axes and Z axes. In the sum_a_m expression there are .* * / and ./ expresson with the meshgrid Y and Z. What is the logic in that?
Thanks.
y=linspace(-y_lim,y_lim,600);
z=linspace(-z_lim,z_lim,600);
[Y,Z]=meshgrid(y,z);
sum_a_m=0;
for m=-300:300
%sum of evanacent wave coefficients
if(m~=0)
a_m=-1i*sqrt(k^2-k_t_m^2);
sum_a_m=sum_a_m+(exp(-1i*(2*pi*m/d)*Y).*exp(-a_m*abs(Z))./a_m);
end
end
E_total_2_51=E_0*exp(-1i*k*Y*sin(theta_in)).*exp(-1i*k*Z*cos(theta_in)) ...
-((eta*I0)/(2*cos(theta_in)*d)).*exp(-1i*k*Y*sin(theta_in)).*exp(-1i*k*abs(Z)*cos(theta_in))...
-(((1i*k*eta*I0)/(2*d)).*exp(-1i*k.*Y*sin(theta_in)).*sum_a_m);

답변 (1개)

Steven Lord
Steven Lord 2024년 4월 24일
See this documentation page for a description of the difference between the * and .* operators (and similarly / and ./, etc.)

카테고리

Help CenterFile Exchange에서 Line Plots에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by