From: Bogathi on
hi,
Recently i have problem in plotting a function. here it is
E_i = (E_x, E_y,E_z), components of a vector in Cartesian. Each of the component is a function of cylindrical coordinates, ie.,E_i is 3-d matrx . I want to plot these components in Cartesian planes - XZ,YZ. I could get XY from pol2cart command.
Can any one help in this regard.
Thnks in advance.
Reddy
From: Roger Stafford on
"Bogathi " <bogathi.reddy(a)gmail.com> wrote in message <hv0cil$5j9$1(a)fred.mathworks.com>...
> hi,
> Recently i have problem in plotting a function. here it is
> E_i = (E_x, E_y,E_z), components of a vector in Cartesian. Each of the component is a function of cylindrical coordinates, ie.,E_i is 3-d matrx . I want to plot these components in Cartesian planes - XZ,YZ. I could get XY from pol2cart command.
> Can any one help in this regard.
> Thnks in advance.
> Reddy

If I understand you correctly, I can't see that there is any difficulty here. You apparently want surface plots made of each of the vector field components for planes orthogonal to each of the three cartesian axes. Each of these components is a known function of the cylindrical coordinates, r, t (theta), and z. (I'm assuming the usual definition of cylindrical coordinates in terms of x, y, and z holds.)

For a plane orthogonal to the y-axis ("XZ plane"), just establish a rectangular mesh in x and z coordinates with y held to some constant, y0.

[X,Z] = meshgrid(linspace(x1,x2),linspace(z1,z2)); % x and z limits
R = sqrt(X.^2+y0^2);
T = atan2(y0,X);

For the E_x component, for example, do this plot:

surf(X,Z,E_x(R,T,Z))

where E_x can be evaluated, as you have said, in terms of r, t, and z. This gives you a rectangular grid of points as projected onto the XZ plane.

Roger Stafford