Arrow in quiver plot does not show with change of position
1 view (last 30 days)
Show older comments
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)
--------------------------------------------------------------------------------------
0 Comments
Answers (1)
KSSV
on 21 Aug 2022
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)
See Also
Categories
Find more on Vector Fields in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!