フィルターのクリア

how do I fill between 3 lines?

1 回表示 (過去 30 日間)
Jarrod
Jarrod 2023 年 9 月 28 日
編集済み: Matt J 2023 年 9 月 28 日
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 件のコメント
Walter Roberson
Walter Roberson 2023 年 9 月 28 日
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.

サインインしてコメントする。

採用された回答

Matt J
Matt J 2023 年 9 月 28 日
編集済み: Matt J 2023 年 9 月 28 日
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 件)

カテゴリ

Help Center および File Exchange2-D and 3-D Plots についてさらに検索

タグ

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by