Plot vector field in Cylindrical
13 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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.
0 commentaires
Réponses (1)
Gautam
le 23 Oct 2024 à 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;
0 commentaires
Voir également
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!