plotting graphs in matlab
1 visualizzazione (ultimi 30 giorni)
Mostra commenti meno recenti
Elliott Cameron
il 25 Apr 2020
Commentato: Elliott Cameron
il 26 Apr 2020
Hello
If i had the following
clear
clc
x=0:10
y=-2*x+6
y1=3*x
plot(x,y)
hold on
plot(x,y1)
how would i just plot the graph with the limits being the x and y intercept
7 Commenti
Tommy
il 25 Apr 2020
Ah! Yes I agree... I do often question if I really understand what's being asked, and whether my "answer" is a full answer, but too often I default to the comment section
Risposta accettata
Tommy
il 25 Apr 2020
You can solve for the intercepts using the equation for y1 and update the axes limits accordingly:
clear
clc
x=0:10;
y1=-2*x+6;
y=3*x;
plot(x,y)
hold on
plot(x,y1)
yint = 6; % -2*0 + 6 => 6
xint = 3; % (0 - 6)/(-2) => 3
ax = gca;
ax.XLim(2) = xint;
ax.YLim(2) = yint;
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Graphics Performance 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!