フィルターのクリア

Fill the color in the plot

1 回表示 (過去 30 日間)
Muhammad Atif
Muhammad Atif 2020 年 4 月 15 日
編集済み: Adam Danz 2020 年 4 月 17 日
Hi experts,
I want to fill up the color for which the plot is one and omit the line for which it is zero, how can I do this??
t1 = 0:0.01:30;
G_on = (t1<1.14) | (t1>2.09 & t1<4.54) | (t1>5.64 & t1<6.31) | (t1>6.99 & t1<8.05) | (t1>8.25 & t1<8.58) | (t1>9.09 & t1<10.75) | (t1>12.75 & t1<15.51) | (t1>16.24 & t1<16.75) | (t1>17.75 & t1<19.51) | (t1>19.71 & t1<20.51) | (t1>21.11 & t1<21.95) | (t1>22.50 & t1<23.34) | (t1>24.11 & t1<25.1) | (t1>25.81 & t1<26.64) | (t1>27.11 & t1<28.54) | (t1>29.11);
x = ones(1,numel(t1));
x(G_on)=0;
plot(t1,x,'r')

採用された回答

Adam Danz
Adam Danz 2020 年 4 月 15 日
編集済み: Adam Danz 2020 年 4 月 17 日
patch(t1, x, 'b')
ylim([-1 2])

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeCreating and Concatenating Matrices についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by