Plot vector field in Cylindrical

14 ビュー (過去 30 日間)
Truong Tong Quang
Truong Tong Quang 2019 年 11 月 23 日
回答済み: Gautam 2024 年 10 月 23 日 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.

回答 (1 件)

Gautam
Gautam 2024 年 10 月 23 日 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;

カテゴリ

Help Center および File ExchangeSmoothing and Denoising についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by