How do shade different area with specific y interval
Afficher commentaires plus anciens
My codes are as follows:
clear
x = 0:0.01:9;
y = sqrt(x);
plot(x, y)
hold on;
x = 1:0.01:9;
[m n]=size(x)
y1=ones(1,n);
plot(x,y1,'r--')
hold on
x = 4:0.01:9;
[m n]=size(x)
y2=ones(1,n)*2;
plot(x,y2,'r--')
hold on
text(2.8, 2,'$y=\sqrt x$', 'interpreter','latex')
text(5.5, 0.2,'Shade this area by green')
text(5.5, 1.2,'Shade this area by red')
text(5.5, 2.2,'Shade this area by blue')
1 commentaire
Wan-Yi Chiu
le 25 Août 2021
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Labels and Annotations dans Centre d'aide et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
