필터 지우기
필터 지우기

Avoiding NaN in a piecewise function

조회 수: 2 (최근 30일)
Maurilio Matracia
Maurilio Matracia 2021년 3월 25일
답변: Walter Roberson 2021년 3월 25일
Hello everyone,
I have a piecewise function that I am trying to express by means of indicator functions depending on the value of the variable z:
F_Ta = @(z) F_Ta_II(z) .* (z<Rd) + F_Ta_III(z) .* (z>=Rd)
where F_Ta_III can assume an infinite value only when z<Rd, implying that when F_Ta_III goes to infinity then the second addend becomes NaN and the whole expression consequently is NaN. In such case, instead, I would like the second addend to become zero since only the first indicator is met.
In other words, I would like to give priority to the indicator functions, so that when any indicator is not met then the respective addend is zero anyways.
Thank you in advance for your help :)

채택된 답변

Walter Roberson
Walter Roberson 2021년 3월 25일
F_Ta = @(z) F_Ta_II(z) .* (z<Rd) + min(realmax, F_Ta_III(z)) .* (z>=Rd)

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Develop Apps Using App Designer에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by