How to move quiver arrows within the semi-circle

11 views (last 30 days)
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?

Accepted Answer

Voss
Voss on 16 Apr 2022
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 Comments
Jong Hyun Lee
Jong Hyun Lee on 16 Apr 2022
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 on 16 Apr 2022
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)

Sign in to comment.

More Answers (0)

Categories

Find more on Vector Fields in Help Center and File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!