how to write log base 2 in matlab coding

조회 수: 3 (최근 30일)
Prabha Kumaresan
Prabha Kumaresan 2017년 11월 8일
답변: Andrew Rockhill 2022년 9월 16일
expression for log base 2 in matlab coding

채택된 답변

michio
michio 2017년 11월 8일
Y = log2(X)

추가 답변 (1개)

Andrew Rockhill
Andrew Rockhill 2022년 9월 16일
To find the log in any base, make use of the base-change formula:
log_b(x) = log_a(x)/log_a(b)
So you can create a function logb = @(b,x) log(x)/log(b);
Then Y = logb(2,x);
Or, more generally;
Y = logb(b,x);

카테고리

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

태그

Community Treasure Hunt

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

Start Hunting!

Translated by