8 views (last 30 days)

In the follwoing I want to insert arrows at the middle of each of the parallel lines

p = 0.01:.05:1;

figure(1)

plot([0; 1],[p; p], 'color','b');

x = [0.3,0.5];

y = [p,p+0.1];

a = annotation('arrow',x,y);

How to do that ? But my code does not work

KSSV
on 8 Jul 2020

Edited: KSSV
on 8 Jul 2020

Why annotation for this? You can use quiver. Play around with the below code.

clc; clear all ;

p = 0.01:.05:1;

x =[0;1] ;

y = [p ;p] ;

x1 = repmat(0.5,1,20);

y1 = p ;

u1 = -0.2*ones(size(y1)) ;

v1 = zeros(size(x1)) ;

figure(1)

hold on

plot(x,y, 'color','b');

quiver(x1,p,u1,v1)

quiver(x1+0.1,p,u1,v1)

KSSV
on 8 Jul 2020

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

Start Hunting!
## 3 Comments

## Direct link to this comment

https://in.mathworks.com/matlabcentral/answers/560768-how-to-insert-arrows-at-the-middle-of-each-of-the-parallel-lines#comment_927941

⋮## Direct link to this comment

https://in.mathworks.com/matlabcentral/answers/560768-how-to-insert-arrows-at-the-middle-of-each-of-the-parallel-lines#comment_927941

## Direct link to this comment

https://in.mathworks.com/matlabcentral/answers/560768-how-to-insert-arrows-at-the-middle-of-each-of-the-parallel-lines#comment_927953

⋮## Direct link to this comment

https://in.mathworks.com/matlabcentral/answers/560768-how-to-insert-arrows-at-the-middle-of-each-of-the-parallel-lines#comment_927953

## Direct link to this comment

https://in.mathworks.com/matlabcentral/answers/560768-how-to-insert-arrows-at-the-middle-of-each-of-the-parallel-lines#comment_927956

⋮## Direct link to this comment

https://in.mathworks.com/matlabcentral/answers/560768-how-to-insert-arrows-at-the-middle-of-each-of-the-parallel-lines#comment_927956

Sign in to comment.