I am supposed to get answer as 949.5

조회 수: 1 (최근 30일)
Jobin Geevarghese Thampi
Jobin Geevarghese Thampi 2022년 4월 30일
댓글: Image Analyst 2022년 4월 30일

답변 (1개)

Image Analyst
Image Analyst 2022년 4월 30일
Try this:
if t > 0 && t < 100
h = t-10;
elseif t >= 100
h = 0.45 * t + 100;
end
What did you enter for the value of t? 1887.77777777778? That would give 949.5.
  댓글 수: 2
Jobin Geevarghese Thampi
Jobin Geevarghese Thampi 2022년 4월 30일
Image Analyst
Image Analyst 2022년 4월 30일
OK, that looks right. It should run without errors, and if you pass in 1887.77777777778, that would give 949.5. See:
h = temp(1887.77777777778)
h = 949.5000
function h = temp(t)
if t > 0 && t < 100
h = t-10;
elseif t >= 100
h = 0.45 * t + 100;
end
end

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

카테고리

Help CenterFile Exchange에서 Statistics and Machine Learning Toolbox에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by