Info

Cette question est clôturée. Rouvrir pour modifier ou répondre.

How do I express the error values from math formula with matlab code

1 vue (au cours des 30 derniers jours)
Boyu Liu
Boyu Liu le 7 Mai 2019
Clôturé : MATLAB Answer Bot le 20 Août 2021
The formula is (x1-x2)/(10-2*x1)
And I want to say x1 is not able to equal to 5 in matlab code, how do I express this in codes?
  1 commentaire
KALYAN ACHARJYA
KALYAN ACHARJYA le 8 Mai 2019
Modifié(e) : KALYAN ACHARJYA le 8 Mai 2019
x1=input('Enter x1: ');
x2=input('Enter x2: ');
if x1==5
disp('Invalid x1 value');
else
fun=(x1-x2)/(10-2*x1);
fprintf('The Function value is: %f',fun);
end

Réponses (0)

Cette question est clôturée.

Community Treasure Hunt

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

Start Hunting!

Translated by