Azzera filtri
Azzera filtri

I want to put arrows on each of the lines parallel to x-axis using LOOP

4 visualizzazioni (ultimi 30 giorni)
I want to put arrows on each of the lines parallel to x-axis using LOOP
Here I am able to put one arrow. Using
q = 0.2:.2:1;
xx = [0.56 0.57]; % adjust length and location of arrow
yy = [q q];
I failed to get the desired arrows. How to modify the code below to get arrows on each blue lines.
p = 0.02:.07:1;
plot([0; 1],[p; p], 'color','b');
%q = 0.2:.2:1;
xx = [0.56 0.57]; % adjust length and location of arrow
yy = [0.9 0.9];
annotation('textarrow',xx,yy,'FontSize',13,'Linewidth',2)
xlabel('$x\rightarrow$','FontSize',20,'interpreter','latex','FontWeight','normal','Color','k')
ylabel('$y\rightarrow$','FontSize',20,'interpreter','latex','FontWeight','normal','Color','k')
axis([0 1 0 .5]);

Risposta accettata

Alan Stevens
Alan Stevens il 8 Nov 2022
Like this?
p = 0.02:.07:1;
plot([0; 1],[p; p], 'color','b');
hold on
%q = 0.2:.2:1;
xx = [0.5 0.57]; % adjust length and location of arrow
ly = 0.15; d = 0.0555;
for i=1:numel(p)
yy = [ly ly];
ly = ly+d;
annotation('textarrow',xx,yy,'FontSize',13,'Linewidth',2)
end
xlabel('$x\rightarrow$','FontSize',20,'interpreter','latex','FontWeight','normal','Color','k')
ylabel('$y\rightarrow$','FontSize',20,'interpreter','latex','FontWeight','normal','Color','k')

Più risposte (0)

Categorie

Scopri di più su Creating and Concatenating Matrices in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by