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!

 採用された回答

KSSV
KSSV 2020 年 5 月 5 日

0 投票

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

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeMATLAB Coder についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by