Arrow in quiver plot does not show with change of position
조회 수: 5 (최근 30일)
이전 댓글 표시
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
답변 (1개)
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)
참고 항목
카테고리
Help Center 및 File Exchange에서 Vector Fields에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!