Make a vector plot of the velocity field in polar coordinates

44 次查看(过去 30 天)
After plotting contour lines of the pressure, which I did easily, I am asked to make a vector plot of the velocity field. The pressure is given as P=(c*(R1/R2)-(1-c))*log((X.^2+Y.^2).^(1/2))/log(R2/R1)+1-c and P=(c*(R1/R2)-(1-c))*log(r)/log(R2/R1)+1-c in polar coordinates, where c, R1 and R2 are constants. I was able to make the vector plots of the cartesian part using this code but I do not know how to do it in polar coordinates. Thank you.
c=0.1;
R1=1;
R2=10;
x = 1:10;
y = 1:10;
[X,Y] = meshgrid(x,y);
P=(c*(R1/R2)-(1-c))*log((X.^2+Y.^2).^(1/2))/log(R2/R1)+1-c;
p_x=(c*(R1/R2)-(1-c))*(X/(X.^2+Y.^2))/log(R2/R1);
p_y=(c*(R1/R2)-(1-c))*(Y/(X.^2+Y.^2))/log(R2/R1);
figure;
quiver(X,Y,p_x,p_y)
title('Velocity field plot')

回答(1 个)

Chad Greene
Chad Greene 2021-5-7
Can you use cart2pol to convert the coordinates and vector components to polar coordinates?
  1 个评论
Marina Markaki
Marina Markaki 2021-5-8
This is the code that I wrote but it gives me the error that U and V must be the same size.
c=0.1;
R1=1;
R2=10;
x = -10:10;
y = -10:10;
[theta,rho] = cart2pol(x,y);
P=(c*(R1/R2)-(1-c))*log(rho)/log(R2/R1)+1-c;
p_r=(c*(R1/R2)-(1-c))./(rho*log(R2/R1));
p_theta=0;
figure;
quiver(theta,rho,p_r,p_theta)
title('Velocity field plot')

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Annotations 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by