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

4 ビュー (過去 30 日間)
Atom
Atom 2022 年 11 月 8 日
コメント済み: Atom 2022 年 11 月 8 日
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]);

採用された回答

Alan Stevens
Alan Stevens 2022 年 11 月 8 日
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')

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeCreating and Concatenating Matrices についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by