Arrow in quiver plot does not show with change of position

1 回表示 (過去 30 日間)
Abhik Saha
Abhik Saha 2022 年 8 月 21 日
コメント済み: Abhik Saha 2022 年 8 月 21 日
I have a program copy below that generate a quiver plot. For x1=0,y1=0. But if I change the value of the x1=0.25 or higher value with same spacing then it does not show all the points in the quiver plot. I am new to matlab. please help regarding this issue?
I am copying the code below
------------------------------------------------------------------------------
spacing = 0.1;
[x,y] = meshgrid(-1:spacing:1);
x1=0.25;y1=0;
Tau=1;
r=sqrt(x.^2+y.^2);
r1=sqrt(x1^2+y1^2);
A=0.5/pi;
U=-((A*Tau*(y-y1))./(abs(r-r1).^2));
V=((A*Tau*(x-x1))./(abs(r-r1).^2));
figure(1);clf;
plot(x,y,'ob')
hold on
plot(x1,y1,'or','linewidth',2)
quiver(x,y,U,V)
--------------------------------------------------------------------------------------

回答 (1 件)

KSSV
KSSV 2022 年 8 月 21 日
You may consider dividng the component of vector with the magnitude and plot.
spacing = 0.1;
[x,y] = meshgrid(-1:spacing:1);
x1=0.25;y1=0;
Tau=1;
r=sqrt(x.^2+y.^2);
r1=sqrt(x1^2+y1^2);
A=0.5/pi;
U=-((A*Tau*(y-y1))./(abs(r-r1).^2));
V=((A*Tau*(x-x1))./(abs(r-r1).^2));
W = sqrt(U.^2+V.^2) ;
figure(1);clf;
plot(x,y,'ob')
hold on
plot(x1,y1,'or','linewidth',2)
quiver(x,y,U./W,V./W)
  1 件のコメント
Abhik Saha
Abhik Saha 2022 年 8 月 21 日
Ok This works but for large values of x and y meaning that when it is close to plus/minus one then the height of the arrow should decrease to describe the behaviour. But this is missing here How can I generate this ?

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeVector Fields についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by