Variable change with time interval

5 ビュー (過去 30 日間)
David Cirino
David Cirino 2019 年 2 月 1 日
回答済み: Kevin Phung 2019 年 2 月 1 日
How can I create a code in matlab that changes the value of a Variable depending on the time interval?
For example different values of X as time progresses:
x=1 for 0<=t<900
x=2 for 900<=t<1800
X=3 for 1800<=t<=2700
X is my variable and t is time.

採用された回答

Kevin Phung
Kevin Phung 2019 年 2 月 1 日
you can use if/else statements
example:
if and(t >= 0, t < 900)
x=1;
elseif and(t>= 900, t<1800)
x=2;
elseif and(t >= 1800, t<= 2700)
x=3;
end

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeMATLAB についてさらに検索

製品


リリース

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by