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!

 Réponse acceptée

KSSV
KSSV le 5 Mai 2020

0 votes

if max(a)<10
CL = fun1(a) ;
else
CL = fun2(a) ;
end

Plus de réponses (0)

Catégories

En savoir plus sur MATLAB Coder dans Centre d'aide et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by