Plotting a vector field in an annulus

Here is the problem:
Suppose I have an annulus with inner radius 0.71392 and the outer radius 1. I want to plot a vector field on the annulus, where the vectors are unit tangent vectors to the concentric circles within the annulus. Here is the geometry I am talking about:
t=0:0.001:2*pi;
x=cos(t);
y=sin(t);
x1=0.71392*cos(t);
y1=0.71392*sin(t);
x2=cos(t);
y2=sin(t);
plot(x,y,'r',x1,y1,'b',x2,y2,'g');
axis equal
Any suggestion would be greatly appreciated.

 Respuesta aceptada

KSSV
KSSV el 9 de Ag. de 2021
Editada: KSSV el 9 de Ag. de 2021
clc; clear all ;
t=0:0.001:2*pi;
x=cos(t);
y=sin(t);
x1=0.71392*cos(t);
y1=0.71392*sin(t);
x2=cos(t);
y2=sin(t);
% Unit tangent vectros
dx1 = gradient(x1) ;
dy1 = gradient(y1) ;
modv1 = sqrt(dx1.^2+dy1.^2) ;
Tx1 = dx1./modv1 ;
Ty1 = dy1./modv1 ;
dx2 = gradient(x2) ;
dy2 = gradient(y2) ;
modv2 = sqrt(dx2.^2+dy2.^2) ;
Tx2 = dx2./modv2 ;
Ty2 = dy2./modv2 ;
plot(x1,y1,'b',x2,y2,'g');
axis equal
hold on
idx = 1:200:length(x1) ;
quiver(x1(idx),y1(idx),Tx1(idx),Ty1(idx),'r')
quiver(x2(idx),y2(idx),Tx2(idx),Ty2(idx),'r')

5 comentarios

Avishek Mukherjee
Avishek Mukherjee el 9 de Ag. de 2021
@KSSV, Thanks for the suggestion.
I think the above code creates vector field of unit tangent vectors on the inner and the outer circle. When executed, it gives me the following figure:
What I want is a quiver plot of vector field inside the annulus such that the vector field inside the annulus consists of unit vectors that are tangent to the concentric circles inside the annulus, for example, something like this:
KSSV
KSSV el 9 de Ag. de 2021
Check the figure.....
Avishek Mukherjee
Avishek Mukherjee el 9 de Ag. de 2021
@KSSV, Thanks. this works. Also, I want a similar field inside the annulus too as the figure in my previous post.
I tried a for loop for generating the vector field inside the annulus, but couldn't get it to work.
KSSV
KSSV el 9 de Ag. de 2021
Generate the radii, make circel and follow the same.,
Avishek Mukherjee
Avishek Mukherjee el 9 de Ag. de 2021
@KSSV, I can do it manually. But instead of manually doing it, I created a sequence of radii and created a vector field for each of the radii inside the annulus. The code I implented is this:
t=0:0.001:2*pi;
r = 0.71392:4.5526e-05:1;
x=cos(t);
y=sin(t);
x1=r.*cos(t);
y1=r.*sin(t);
x2=cos(t);
y2=sin(t);
% Unit tangent vectros
dx1 = gradient(x1) ;
dy1 = gradient(y1) ;
modv1 = sqrt(dx1.^2+dy1.^2) ;
Tx1 = dx1./modv1 ;
Ty1 = dy1./modv1 ;
dx2 = gradient(x2) ;
dy2 = gradient(y2) ;
modv2 = sqrt(dx2.^2+dy2.^2) ;
Tx2 = dx2./modv2 ;
Ty2 = dy2./modv2 ;
plot(x1,y1,'b',x2,y2,'g');
axis equal
hold on
idx = 1:200:length(x1) ;
quiver(x1(idx),y1(idx),Tx1(idx),Ty1(idx),'r')
quiver(x2(idx),y2(idx),Tx2(idx),Ty2(idx),'r')
which produces a spiral:

Iniciar sesión para comentar.

Más respuestas (0)

Preguntada:

el 9 de Ag. de 2021

Comentada:

el 9 de Ag. de 2021

Community Treasure Hunt

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

Start Hunting!

Translated by