math operation

3 ビュー (過去 30 日間)
sam arf
sam arf 2012 年 4 月 4 日
Hi, I have some problem here,
case1, a=7, b=4, a/b = 1.75
case2, a=3, b=2, a/b = 1.5
I want variable "c" to become decimal value of a/b,
c = 0.75 (for case 1), and c = 0.5 (case 2)
wich matlab operation should I use?

採用された回答

Jan
Jan 2012 年 4 月 4 日
a = 7;
b = 4;
c = rem(a / b, 1)
or
c = a / b;
d = c - floor(c);
  1 件のコメント
sam arf
sam arf 2012 年 4 月 6 日
thanks sir,

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeGet Started with MATLAB についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by