Plot vector field in Cylindrical

22 views (last 30 days)
Truong Tong Quang
Truong Tong Quang on 23 Nov 2019
Answered: Gautam on 23 Oct 2024
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.

Answers (1)

Gautam
Gautam on 23 Oct 2024
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!