Calculates the total difference between two numbers

28 ビュー (過去 30 日間)
Adam
Adam 2022 年 11 月 6 日
編集済み: Guru Kumaresan 2022 年 11 月 9 日
I want it to calculate the difference between two given numbers.
  1 件のコメント
Torsten
Torsten 2022 年 11 月 6 日
a = 5;
b = 3;
difference = a-b
difference = 2

サインインしてコメントする。

回答 (1 件)

Guru Kumaresan
Guru Kumaresan 2022 年 11 月 9 日
編集済み: Guru Kumaresan 2022 年 11 月 9 日
Hi Adam,
I understand that you are trying to find the difference between two numbers. For this purpose, you can use absolute value function available in MATLAB.
Example:
a = 2;
b = 5;
Diff = abs(a-b);
Diff will have the value of 3.
Hope this helps!

カテゴリ

Help Center および File ExchangeMathematics についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by