How to move quiver arrows within the semi-circle

1 回表示 (過去 30 日間)
Jong Hyun Lee
Jong Hyun Lee 2022 年 4 月 16 日
コメント済み: Voss 2022 年 4 月 16 日
x=0:0.01:1;
y=0:0.01:1;
x=x.^2
y=-x.*y
c=10
quiver(x(1:c:end),y(1:c:end))
hold on
y=-x+1
plot(x,y)
y=sqrt(1-x.^2)
plot(x,y)
xlim([0 12])
ylim([0 1])
This code gave me this plot.
However, I want to obtain a plot something like this:
Sorry for the bad explanation.
Is it possible to move the quiver arrows to fit in the semi-circle equation?

採用された回答

Voss
Voss 2022 年 4 月 16 日
It's not clear how you determine where the quivers start, i.e., where the 'base' of each one (not the arrow end - the other end) belongs, so here they all start along the line y = 1:
x=0:0.01:1;
y=sqrt(1-x.^2);
c=10;
xq = x(1:c:end); % an arrow at each x
nq = numel(xq);
yq = ones(1,nq); % all starting along the line y = 1
uq = zeros(1,nq); % pointing straight down: u = zero (no x-component)
vq = y(1:c:end)-1; % v = y-1 (from the line y = 1 to the curve y = sqrt(1-x^2))
quiver(xq,yq,uq,vq,'AutoScale','off')
hold on
plot(x,1-x)
plot(x,y)
  2 件のコメント
Jong Hyun Lee
Jong Hyun Lee 2022 年 4 月 16 日
Thank you for the answer. However, the plot that you obtained have vertical arrows not inclined. How can I use quiver function to plot inclined arrows?
The quiver starts at y=1
Voss
Voss 2022 年 4 月 16 日
Here are some inclined arrows starting at y=1:
x=0:0.01:1;
y=sqrt(1-x.^2);
c=10;
xq = x(1+c:c:end);
nq = numel(xq);
yq = ones(1,nq);
uq = x(1:c:end-c)-xq;
vq = y(1:c:end-c)-1;
quiver(xq,yq,uq,vq,'AutoScale','off')
hold on
plot(x,1-x)
plot(x,y)

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

その他の回答 (0 件)

カテゴリ

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