How to plot Poynting vector by using values of matrices.
14 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Hi all, here i got the matrices of poynting vector components py and pz, which are 301*301 and attached as files, and i want to plot poynting vector by using py and pz. the code i utilized are as follow. But the picture (see attached image) looks not correct. anyone could help me? thanks very much. Note that the red arrow in the attached image is the propagation direction of wave, thus the poynting vector should also be in the same direction as the red arrow.
[Y Z]=meshgrid(-1:0.005:0.5);
Sy=gradient(Py(:,1:end),0.005);
Sz=gradient(Pz(1:end,:),0.005);
quiver(Y,Z,Sy,Sz,1,'w');
another way to get gradients:
[Y Z]=meshgrid(-1:0.005:0.5);
V_p=sqrt(Py.^2+Pz.^2);
[Sy,Sz]=gradient(V_p,0.005,0.005);
quiver(Y,Z,Sy,Sz,1,'w');
the poynting vectors of those two methods are indetical, and wrong.
2 commentaires
Geoff Hayes
le 30 Juil 2014
Hu - can you please verify that the above code and attachments work? I loaded the data via
load('Py.txt')
load('Pz.txt')
and then ran the first block of code (I needed to add a closing bracket the line of Sz). The Sz matrix contained only Inf values. I then tried the second block of code, and the figure appeared as all white with nothing drawn on it.
Réponses (0)
Voir également
Catégories
En savoir plus sur View and Analyze Simulation Results dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!