nested if or piecewise function

1 visualización (últimos 30 días)
liyana nadirah
liyana nadirah el 24 de En. de 2020
Comentada: Mohammad Sami el 26 de En. de 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 comentarios
tilman knebel
tilman knebel el 24 de En. de 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 el 26 de En. de 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

Iniciar sesión para comentar.

Respuestas (0)

Categorías

Más información sobre Introduction to Installation and Licensing en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by