how do I fill between 3 lines?
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
b = 48
time = 0:1:40000;
mFast = 6/30
mSlow = 4.3/30
yFast = (mFast*time)+b
ySlow = (mSlow*time)+b
plot(time,yFast);
xlabel("Time(Minutes)")
ylabel("growth in numbers")
title("Tribble Growth Rate")
legend("Harvester")
hold on
plot(time,ySlow,"DisplayName","Triple Triticale ")
ycutoff=time * 0 +5000
plot(time,ycutoff)
%i need to fill between the 3 lines thats given and need some help%
1 Kommentar
Walter Roberson
am 28 Sep. 2023
I would recommend first calculating the points of intersection between the lines and ycuttoff . Doing so would allow you to calculate the coordinates of the 3 vertices of the triangle, and then you can fill using the coordinates.
Akzeptierte Antwort
Matt J
am 28 Sep. 2023
Bearbeitet: Matt J
am 28 Sep. 2023
One way:
b = 48;
time = 0:1:40000;
mFast = 6/30 ;
mSlow = 4.3/30;
yFast = (mFast*time)+b;
ySlow = (mSlow*time)+b;
plot(time,yFast);
xlabel("Time(Minutes)")
ylabel("growth in numbers")
title("Tribble Growth Rate")
L=legend("Harvester");
hold on
plot(time,ySlow,"DisplayName","Triple Triticale ")
ycutoff=time * 0 +5000;
plot(time,ycutoff)
L.AutoUpdate='off';
V=[0 0
roots([mSlow,b-ycutoff(1)]) ycutoff(1)
roots([mFast,b-ycutoff(1)]) ycutoff(1)];
hold on
plot(polyshape(V),'FaceColor','g')
hold off
0 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu 2-D and 3-D Plots finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!