Round down to nearest 100

조회 수: 45 (최근 30일)
Grant Brown
Grant Brown 2023년 12월 14일
댓글: Voss 2023년 12월 14일
Hello I am doing timing phase correction in a QPSK system. Given a maximum power timing phase I need to round down to nearest 100.
Example:
If I get 568, I want to get 500.
Round(568,-2) gives 600. I need to always round down. What do you all suggest?

채택된 답변

Voss
Voss 2023년 12월 14일
Divide by 100, then floor() or fix() (depending on how you want to handle negative numbers), then multiply by 100.
x = 568;
floor(x/100)*100
ans = 500
fix(x/100)*100
ans = 500
x = -568;
floor(x/100)*100
ans = -600
fix(x/100)*100
ans = -500
  댓글 수: 2
Grant Brown
Grant Brown 2023년 12월 14일
thanks for the help!
Voss
Voss 2023년 12월 14일
You're welcome!

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Elementary Math에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by