I am supposed to get answer as 949.5

1 visualizzazione (ultimi 30 giorni)
Jobin Geevarghese Thampi
Jobin Geevarghese Thampi il 30 Apr 2022
Commentato: Image Analyst il 30 Apr 2022

Risposte (1)

Image Analyst
Image Analyst il 30 Apr 2022
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 Commenti
Image Analyst
Image Analyst il 30 Apr 2022
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

Accedi per commentare.

Categorie

Scopri di più su Modeling in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by