Borrar filtros
Borrar filtros

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

4 visualizaciones (últimos 30 días)
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]);

Respuesta aceptada

Alan Stevens
Alan Stevens el 8 de Nov. de 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')

Más respuestas (0)

Categorías

Más información sobre Creating and Concatenating Matrices en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by