Hello! I have this function:
function CL=coefficient(a)
where the input a is a scalar value and is periodic (from 0 to a max, from max to 0 and so on for a certein number of times). The maximum value (max) is variable, for example a can vary one time from 0 to 4 (and so from 4 to 0) and another from 0 to 15 (and so from 15 to 0) and so forth with different values of the maximum...
I have two different functions to define CL and I need to set the condition in order to obtain:
if a<10
CL=fun1(a)
if a>=10 (condition a=10 reached)
CL=fun2(a) even if the value of are going to be less then 10 ( when a varies from max to 0 maintain the function fun2(a)) .
When a=0 I need to reset all to have fun1(a).
How can I set this condition?
Thank you in advace!

 Respuesta aceptada

KSSV
KSSV el 5 de Mayo de 2020
if max(a)<10
CL = fun1(a) ;
else
CL = fun2(a) ;
end

Más respuestas (0)

Categorías

Más información sobre MATLAB Coder en Centro de ayuda y File Exchange.

Etiquetas

Preguntada:

el 5 de Mayo de 2020

Comentada:

el 5 de Mayo de 2020

Community Treasure Hunt

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

Start Hunting!

Translated by