필터 지우기
필터 지우기

Rounding off and approximation functions.

조회 수: 2 (최근 30일)
Reinhardt RADING
Reinhardt RADING 2021년 4월 20일
댓글: Steven Lord 2021년 4월 20일
I have a matlab formula i.e,
Nsymb = (abs(Dcum)*deltaf(sp)*(lam^2)* Symbolrate* 1e-3)/clight
The value of Nysmb varies i.e 14, 10, 28, 36..
I would love to round off to the nearest power factor of 2. For example if Nsymb from the formula is 14, i want to write the code to make Nsymb = 16.
If Nysmb from the formula is 28, i want to make Nsymb =32... if 36, Nsymb=64.. so on.
How can i do this?
Thanks in advance.
  댓글 수: 3
Reinhardt RADING
Reinhardt RADING 2021년 4월 20일
In number.
How do you propose using log2?
the cyclist
the cyclist 2021년 4월 20일
Maybe I have not had enough coffee yet, but why would 36 round to 64? It is much closer to 32.
Or do you mean ceiling, and not round? Or maybe just a typo in your question?

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

채택된 답변

Steven Lord
Steven Lord 2021년 4월 20일
N = 14;
x = 2.^nextpow2(N)
x = 16
  댓글 수: 3
Reinhardt RADING
Reinhardt RADING 2021년 4월 20일
This is brilliant.
Thanks for helping.
Steven Lord
Steven Lord 2021년 4월 20일
Always a new MATLAB function to know.
Cool, you're one of today's ten thousand to learn about this 20+ year old function.

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Spline Postprocessing에 대해 자세히 알아보기

제품


릴리스

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by