Matlab logic of plotting meshgrid formula

2 visualizaciones (últimos 30 días)
fima v
fima v el 24 de Abr. de 2024
Respondida: Steven Lord el 24 de Abr. de 2024
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);

Respuestas (1)

Steven Lord
Steven Lord el 24 de Abr. de 2024
See this documentation page for a description of the difference between the * and .* operators (and similarly / and ./, etc.)

Categorías

Más información sobre Line Plots en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by