Filter löschen
Filter löschen

nested if or piecewise function

2 Ansichten (letzte 30 Tage)
liyana nadirah
liyana nadirah am 24 Jan. 2020
Kommentiert: Mohammad Sami am 26 Jan. 2020
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 Kommentare
tilman knebel
tilman knebel am 24 Jan. 2020
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 am 26 Jan. 2020
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

Melden Sie sich an, um zu kommentieren.

Antworten (0)

Kategorien

Mehr zu Introduction to Installation and Licensing finden Sie in Help Center und File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by