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 CenterFile Exchange에서 Get Started with MATLAB에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by