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 Exchange에서 MATLAB Coder에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by