Plot vector field in Cylindrical

조회 수: 8 (최근 30일)
Truong Tong Quang
Truong Tong Quang 2019년 11월 23일
답변: Gautam 2024년 10월 23일
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.

답변 (1개)

Gautam
Gautam 2024년 10월 23일
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;

카테고리

Help CenterFile Exchange에서 Smoothing and Denoising에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by