I am supposed to get answer as 949.5
1 次查看(过去 30 天)
显示 更早的评论
回答(1 个)
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 个评论
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)
function h = temp(t)
if t > 0 && t < 100
h = t-10;
elseif t >= 100
h = 0.45 * t + 100;
end
end
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!