# Matlab logic of plotting meshgrid formula

1 visualizzazione (ultimi 30 giorni)
fima v il 24 Apr 2024
Risposto: Steven Lord il 24 Apr 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);
##### 0 CommentiMostra -2 commenti meno recentiNascondi -2 commenti meno recenti

Accedi per commentare.

### Risposte (1)

Steven Lord il 24 Apr 2024
See this documentation page for a description of the difference between the * and .* operators (and similarly / and ./, etc.)
##### 0 CommentiMostra -2 commenti meno recentiNascondi -2 commenti meno recenti

Accedi per commentare.

### Categorie

Scopri di più su Grid Lines, Tick Values, and Labels in Help Center e File Exchange

### Community Treasure Hunt

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

Start Hunting!

Translated by