Azzera filtri
Azzera filtri

how do I fill between 3 lines?

1 visualizzazione (ultimi 30 giorni)
Jarrod
Jarrod il 28 Set 2023
Modificato: Matt J il 28 Set 2023
b = 48
b = 48
time = 0:1:40000;
mFast = 6/30
mFast = 0.2000
mSlow = 4.3/30
mSlow = 0.1433
yFast = (mFast*time)+b
yFast = 1×40001
48.0000 48.2000 48.4000 48.6000 48.8000 49.0000 49.2000 49.4000 49.6000 49.8000 50.0000 50.2000 50.4000 50.6000 50.8000 51.0000 51.2000 51.4000 51.6000 51.8000 52.0000 52.2000 52.4000 52.6000 52.8000 53.0000 53.2000 53.4000 53.6000 53.8000
ySlow = (mSlow*time)+b
ySlow = 1×40001
48.0000 48.1433 48.2867 48.4300 48.5733 48.7167 48.8600 49.0033 49.1467 49.2900 49.4333 49.5767 49.7200 49.8633 50.0067 50.1500 50.2933 50.4367 50.5800 50.7233 50.8667 51.0100 51.1533 51.2967 51.4400 51.5833 51.7267 51.8700 52.0133 52.1567
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
ycutoff = 1×40001
5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000
plot(time,ycutoff)
%i need to fill between the 3 lines thats given and need some help%
  1 Commento
Walter Roberson
Walter Roberson il 28 Set 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.

Accedi per commentare.

Risposta accettata

Matt J
Matt J il 28 Set 2023
Modificato: Matt J il 28 Set 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

Più risposte (0)

Categorie

Scopri di più su 2-D and 3-D Plots 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!

Translated by