nested if or piecewise function

1 回表示 (過去 30 日間)
liyana nadirah
liyana nadirah 2020 年 1 月 24 日
コメント済み: Mohammad Sami 2020 年 1 月 26 日
can someone explain to me how to do matlab coding for this piecewise function. did i have to do nested if coding to solve this function
  2 件のコメント
tilman knebel
tilman knebel 2020 年 1 月 24 日
The fastest way is, to evaluate it for all required t at once: create the target array with "zeros" and fill in the solution for each of both partitions.
Mohammad Sami
Mohammad Sami 2020 年 1 月 26 日
You can use a switch statement
switch true
case t <= t_prime
out = 0
case t <= Y && t > t_prime
out = 3 % rest of your expression;
otherwise
out = 1 % rest of your expression;
end

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

回答 (0 件)

カテゴリ

Help Center および File ExchangeIntroduction to Installation and Licensing についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by