Effacer les filtres
Effacer les filtres

Review following program and fill out the missing values on the code segments

1 vue (au cours des 30 derniers jours)
yesenia Arzate-andujo
yesenia Arzate-andujo le 8 Avr 2020
Modifié(e) : Rik le 8 Avr 2020
I just need to know how to make my code correct. I have no idea how I can even input 33 to get an output..
if input <45 && input > 35
output=2 * input + 3
else if input < =33 && input >= 27
output = input - 10
else if input ==23
output = 2+*4input
else
output = -5
end
end
end
_____________________________________
when input = 33
output = _______
when input = 23
output = _______
when input = 100
output = _______
when input = 37
output = _______
when input = 3
output = _______
  3 commentaires
yesenia Arzate-andujo
yesenia Arzate-andujo le 8 Avr 2020
Modifié(e) : Rik le 8 Avr 2020
So basically teacher wants us to input the given number and find an output...Will I have to remove part of the code inorder to run it with the request of the input??
like do i leave it like :
function o=changeInput(x)
if x<45 && x>35
o=2*x+3;
elseif (input <=33 && input>= 27)
output = input - 10;
elseif (input==23)
output = 2+*4input
else
output = -5;
end
end
end
or do I take out a portion of it... like :
function o=changeInput(x)
if x<45 && x>35
o=2*x+3;
elseif (input <=33 && input>= 27)
output = input - 10;
elseif (input==23)
output = 2+*4input
end
end
David Hill
David Hill le 8 Avr 2020
In the case of the function, x is the input. You could also use the input() function (see matlab help) if the desire is to input the number during execution.

Connectez-vous pour commenter.

Réponses (0)

Catégories

En savoir plus sur Environment and Settings dans Help Center et File Exchange

Produits


Version

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by