How to move quiver arrows within the semi-circle

5 次查看(过去 30 天)
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 CenterFile Exchange 中查找有关 Vector Fields 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by