How can i fplot two functions in different intervals?
7 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
I have two functions, F1 and F2. function F1 is calculate in interval [a,b] and function F2 in [c,d]. How can i plot both them in one figure?
0 commentaires
Réponse acceptée
Azzi Abdelmalek
le 26 Juil 2013
Modifié(e) : Azzi Abdelmalek
le 26 Juil 2013
x1=0:0.1:10;
x2=10:0.1:20;
y1=sin(x1);
y2=cos(x2);
plotyy(x1,y1,x2,y2)
% or
x1=0:0.1:10;
x2=10:0.1:20;
y1=sin(x1);
y2=20*cos(x2);
plot(x1,y1);
ax=axes('position',get(gca,'position'),'color','none','XAxisLocation','top','YAxisLocation','right')
plot(x2,y2,'r')
set(ax,'visible','off')
ax=axes('position',get(gca,'position'),'color','none','XAxisLocation','top','YAxisLocation','right')
set(ax,'xcolor','r','ycolor','r','xlim',[min(x2) max(x2)],'ylim',[min(y2) max(y2)])
Voir également
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!