Matlab logic of plotting meshgrid formula

2 次查看(过去 30 天)
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 中查找有关 Grid Lines, Tick Values, and Labels 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by