positive number produced from calculation

2 Ansichten (letzte 30 Tage)
badrul hisham
badrul hisham am 9 Apr. 2016
Kommentiert: badrul hisham am 10 Apr. 2016
hi,i have a calculation that requires the output to be positive value. example: (|0.33-0.42|)=0.9 i tried using abs, but the result is not 0.9. matlab does not recognize the | symbol.im guessing i used abs wrong. can someone please show me how to do this?
  2 Kommentare
Star Strider
Star Strider am 9 Apr. 2016
The problem is that:
result = abs(0.33-0.42)
result =
0.09
What leads you to believe the correct result is 0.9?
badrul hisham
badrul hisham am 10 Apr. 2016
i've tried your coding and it works. it was just my mistake. i called a different input and used it in the the operation. thank you for your help

Melden Sie sich an, um zu kommentieren.

Akzeptierte Antwort

Kuifeng
Kuifeng am 9 Apr. 2016
abs(0.33-0.42)

Weitere Antworten (0)

Kategorien

Mehr zu Programming finden Sie in Help Center und File Exchange

Produkte

Community Treasure Hunt

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

Start Hunting!

Translated by