Plot vector field in Cylindrical

14 visualizaciones (últimos 30 días)
Truong Tong Quang
Truong Tong Quang el 23 de Nov. de 2019
Respondida: Gautam el 23 de Oct. de 2024 a las 6:28
i have a problem with my homeworks,
"Express the vector field A= 3Ux + 4Uy + 5Uz in Cylindrical"
and some similar questions like Cylindrical to Cart, or Spherical.

Respuestas (1)

Gautam
Gautam el 23 de Oct. de 2024 a las 6:28
The conversion from Cartesian to cylindrical coordinates is given by:
The unit vectors in cylindrical coordinates are related to Cartesian unit vectors by:
Here is a MATLAB script to plot the vector field in cylindrical coordinates:
[phi, z, rho] = meshgrid(linspace(0, 2*pi, 20), linspace(-5, 5, 20), linspace(0, 5, 20))
x = rho .* cos(phi);
y = rho .* sin(phi);
% Define the vector field A in Cartesian coordinates
Ax = 3 * ones(size(x));
Ay = 4 * ones(size(y));
Az = 5 * ones(size(z));
% Convert the vector field to cylindrical coordinates
A_rho = Ax .* cos(phi) + Ay .* sin(phi);
A_phi = -Ax .* sin(phi) + Ay .* cos(phi);
A_z = Az;
% Plot the vector field
figure;
quiver3(x, y, z, A_rho .* cos(phi) - A_phi .* sin(phi), ...
A_rho .* sin(phi) + A_phi .* cos(phi), A_z, 'AutoScale', 'on');
xlabel('x');
ylabel('y');
zlabel('z');
axis equal;
grid on;

Community Treasure Hunt

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

Start Hunting!

Translated by