Plot E, H and power using MATLAB

58 views (last 30 days)
Vraj
Vraj on 14 Sep 2022
Answered: Sam Chak on 14 Sep 2022
Consider a plane wave propagating in the +Z direction within a conducting medium. Plot (@ 1 MHz) using MATLAB: (a) Electric field (c) Total power flow (b) Magnetic field along with the E, H and power plots.

Answers (1)

Sam Chak
Sam Chak on 14 Sep 2022
It seemed that @KANISHK also asked the same question a few days ago:
Perhaps this function can help to plot the plane waves in a 3D space.
help plot3
PLOT3 Plot lines and points in 3-D space. PLOT3() is a three-dimensional analogue of PLOT(). PLOT3(x,y,z), where x, y and z are three vectors of the same length, plots a line in 3-space through the points whose coordinates are the elements of x, y and z. PLOT3(X,Y,Z), where X, Y and Z are three matrices of the same size, plots several lines obtained from the columns of X, Y and Z. Various line types, plot symbols and colors may be obtained with PLOT3(X,Y,Z,s) where s is a 1, 2 or 3 character string made from the characters listed under the PLOT command. PLOT3(TBL,XVAR,YVAR,ZVAR) plots the variables xvar, yvar, and zvar from the table tbl. To plot one data set, specify one variable each for xvar, yvar, and zvar. To plot multiple data sets, specify multiple variables for at least one of those arguments. The arguments that specify multiple variables must specify the same number of variables. PLOT3(x1,y1,z1,s1,x2,y2,z2,s2,x3,y3,z3,s3,...) combines the plots defined by the (x,y,z,s) fourtuples, where the x's, y's and z's are vectors or matrices and the s's are strings. Example: A helix: t = 0:pi/50:10*pi; plot3(sin(t),cos(t),t); PLOT3 returns a column vector of handles to lineseries objects, one handle per line. The X,Y,Z triples, or X,Y,Z,S quads, can be followed by parameter/value pairs to specify additional properties of the lines. See also PLOT, LINE, AXIS, VIEW, MESH, SURF. Documentation for plot3 doc plot3
For the Power flow or Poynting vector, these two functions might be useful:
help quiver
QUIVER Quiver plot. QUIVER(X,Y,U,V) plots velocity vectors as arrows with components (u,v) at the points (x,y). The matrices X,Y,U,V must all be the same size and contain corresponding position and velocity components (X and Y can also be vectors to specify a uniform grid). QUIVER automatically scales the arrows to fit within the grid. QUIVER(U,V) plots velocity vectors at equally spaced points in the x-y plane. QUIVER(U,V,S) or QUIVER(X,Y,U,V,S) automatically scales the arrows to fit within the grid and then stretches them by S. Use S=0 or S='off' to plot the arrows without the automatic scaling. QUIVER(...,LINESPEC) uses the plot linestyle specified for the velocity vectors. Any marker in LINESPEC is drawn at the base instead of an arrow on the tip. Use a marker of '.' to specify no marker at all. See PLOT for other possibilities. QUIVER(...,'filled') fills any markers specified. QUIVER(AX,...) plots into AX instead of GCA. H = QUIVER(...) returns a quivergroup handle. Example: [x,y] = meshgrid(-2:.2:2,-1:.15:1); z = x .* exp(-x.^2 - y.^2); [px,py] = gradient(z,.2,.15); contour(x,y,z), hold on quiver(x,y,px,py), hold off, axis image See also FEATHER, QUIVER3, PLOT. Documentation for quiver doc quiver
help contour
CONTOUR Contour plot. CONTOUR(Z) draws a contour plot of matrix Z in the x-y plane, with the x-coordinates of the vertices corresponding to column indices of Z and the y-coordinates corresponding to row indices of Z. The contour levels are chosen automatically. CONTOUR(X,Y,Z) draws a contour plot of Z using vertices from the mesh defined by X and Y. X and Y can be vectors or matrices. CONTOUR(Z,N) and CONTOUR(X,Y,Z,N) draw N contour lines, choosing the levels automatically. CONTOUR(Z,V) and CONTOUR(X,Y,Z,V) draw a contour line for each level specified in vector V. Use CONTOUR(Z,[v v]) or CONTOUR(X,Y,Z,[v v]) to draw contours for the single level v. CONTOUR(AX, ...) plots into the axes AX. [C,H] = CONTOUR(...) returns contour matrix C and a handle, H, to a contour object. These can be used as inputs to CLABEL. The structure of a contour matrix is described in the contour documentation. CONTOUR(..., LineSpec) draws the contours using the line type and color specified by LineSpec (ignoring marker symbols). To specify additional contour properties, you can follow the arguments in any of the syntaxes described above with name-value pairs. Example: [c,h] = contour(peaks); clabel(c,h) See also CONTOUR3, CONTOURF, CLABEL. Documentation for contour doc contour Other functions named contour propagationData/contour

Categories

Find more on Vector Fields in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!