Condition for output result

조회 수: 1 (최근 30일)
Aknur
Aknur 2022년 10월 6일
편집: Aknur 2022년 10월 13일
Hi !
I want to create function and if result of my x1 will be more than 5.0 then request to assume as a result of x1 = 5.0
Or create variables for my output x1, y1. z1 as I have limitation for them
x1 no more than 5.0, and no less than 0 and if bigger then give an answer as 5.0
y1 the same
And for z1 no more than 3.0

채택된 답변

Alan Stevens
Alan Stevens 2022년 10월 6일
Instead of
x1 = x0+B;
how about
x1 = max(min(x0+B,5.0),0);
  댓글 수: 2
Aknur
Aknur 2022년 10월 6일
Dear, @Alan Stevens thank you for your advice. It works perfectly. But still I suppose does not suit to my function and goal. I will continue to think how to achieve my goal
Alan Stevens
Alan Stevens 2022년 10월 7일
So, what exactly is your goal?

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Matched Filter and Ambiguity Function에 대해 자세히 알아보기

제품


릴리스

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by