logB(X) = logA(X) / logA(B) You can pick A to be one of the built in functions, like log or log2 or log10. E.g., log3(9) = log(9) / log(3) , or log3(9) = log10(9) / log10(3) , etc. Answer from James Tursa on mathworks.com
🌐
MathWorks
mathworks.com › symbolic math toolbox › mathematics › mathematical functions
log2 - Base-2 logarithm of symbolic input - MATLAB
For the syntax [F,E] = log2(X), any zeros in X produce F = 0 and E = 0. Input values of Inf, -Inf, or NaN are returned unchanged in F with a corresponding exponent of E = 0. ... Base-2 logarithm values, returned as a symbolic number, vector, matrix, or array of the same size as X.
🌐
MathWorks
mathworks.com › matlab › mathematics › elementary math › exponents and logarithms
log2 - Base 2 logarithm and floating-point number dissection - MATLAB
Exponent values, returned as a scalar, vector, matrix, multidimensional array, table, or timetable of the same size as X. The values in F and E satisfy X = F.*2.^E. This function corresponds to the ANSI® C function frexp() and the IEEE® floating-point standard function logb(). Any zeros in X produce F = 0 and E = 0. ... The log2 function fully supports tall arrays. For more information, see Tall Arrays. This function fully supports thread-based environments. For more information, see Run MATLAB Functions in Thread-Based Environment.
🌐
Johns Hopkins University
math.jhu.edu › ~shiffman › 370 › help › techdoc › ref › log2.html
log2 (MATLAB Function Reference)
Description Y = log2(X) computes the base 2 logarithm of the elements of X. [F,E] = log2(X) returns arrays F and E. Argument F is an array of real values, usually in the range 0.5 abs(F) < 1. For real X, F satisfies the equation: X = F.*2.^E.
logB(X) = logA(X) / logA(B) You can pick A to be one of the built in functions, like log or log2 or log10. E.g., log3(9) = log(9) / log(3) , or log3(9) = log10(9) / log10(3) , etc. Answer from James Tursa on mathworks.com
🌐
Wikipedia
en.wikipedia.org › wiki › Binary_logarithm
Binary logarithm - Wikipedia
February 15, 2026 - If the series is truncated after ... than 2−(m1 + m2 + ⋯ + mi). The log2 function is included in the standard C mathematical functions. The default version of this function takes double precision arguments but variants of it allow the argument to be single-precision or to be a long double. In computing environments supporting complex numbers and implicit type conversion such as MATLAB the argument ...
🌐
MathWorks
mathworks.com › matlab › mathematics › elementary math
Exponents and Logarithms - MATLAB & Simulink
In addition to common functions like exp and log, MATLAB® has several other related functions to allow flexible numerical calculations. The expm1 and log1p functions compensate for numerical round-off errors in small arguments, while the reallog, realpow, and realsqrt functions restrict the range of these functions to real numbers.
Find elsewhere
🌐
MathWorks
mathworks.com › matlabcentral › answers › 1465394-how-do-i-calculate-a-logarithm-of-a-variable-base
How do I calculate a logarithm of a variable base? - MATLAB Answers - MATLAB Central
October 2, 2021 - I saw that calculating log of the base of 10 or e is possible. for an example: after typing log (a,b) - I recieve an ERROR message. I'd like to use "a" as a varying number and change it using a loop until I'll get a good result. "a" can be for an example - 1.05, 1.003.... ... Too many input arguments. ... Sign in to comment. Sign in to answer this question. ... https://www.mathworks.com/matlabcentral/answers/1465394-how-do-i-calculate-a-logarithm-of-a-variable-base#answer_800204
🌐
MathWorks
mathworks.com › matlabcentral › answers › 1853103-base-2-logarithmic-scale-on-bar-diagram
Base-2 logarithmic scale on bar diagram - MATLAB Answers - MATLAB Central
November 16, 2022 - will produce the same relative bar heights as those if you were to mess around with the log2() values and scale them. Sign in to comment. Sign in to answer this question. ... https://www.mathworks.com/matlabcentral/answers/1853103-base-2-logarithmic-scale-on-bar-diagram#answer_1101968
🌐
MathWorks
mathworks.com › fixed-point designer › embedded implementation › function approximation with lookup tables › implement lookup tables in matlab
Implement Fixed-Point Log2 Using Lookup Table - MATLAB & Simulink
Generate lookup table, LOG2LUT, such that the integer i = x_B - 2^(B-1) + 1 is used as an index to LOG2LUT so that log2(x_B) can be evaluated by looking up the index log2(x_B) = LOG2LUT(i).
🌐
MathWorks
uk.mathworks.com › matlabcentral › answers › 281389-double-complex-error-using-quadprog
Double complex-Error using quadprog - MATLAB Answers - MATLAB Central
April 27, 2016 - So I decided to use log base 2 and then I put on SVM Classification I've got these answer · Error using quadprog (line 318) All inputs to QUADPROG must be real. Error in svmtrain (line 528) [alpha, ~, exitflag, output] = quadprog(H,-ones(nPoints,1),[],[],... ... Sign in to comment. Sign in to answer this question. ... https://uk.mathworks.com/matlabcentral/answers/281389-double-complex-error-using-quadprog#answer_219739
🌐
MathWorks
uk.mathworks.com › matlabcentral › answers › 111008-how-to-classify-an-image
how to classify an image - MATLAB Answers - MATLAB Central
December 30, 2013 - I would not advise svm for this. multi-class svm is time consuming and memory consuming. More efficient than multi-class svm is to do ceiling(log2(N)) svm's where N is the number of classes.
🌐
MathWorks
uk.mathworks.com › matlabcentral › answers › 2173638-what-is-the-max-number-of-digits-allowed-for-a-base-2-number
What is the max number of digits allowed for a base 2 number? - MATLAB Answers - MATLAB Central
February 4, 2025 - The default data type in MATLAB is "double", which means 64 bits. When used to represent a base 2 number, its maximum value is 2^64-1 (the value of intmax('uint64')), which is significantly larger than a quadrillion (10^15).
🌐
University of Oxford
eng.ox.ac.uk › media › 8038 › matlab_notes.pdf pdf
AN INTRODUCTION TO USING MATLAB
There are hundreds of functions in MATLAB. To get started consider the standard · mathematical functions that you would expect to find on a calculator. ... The square root. ... The value rounded to the nearest integer. ... The remainder of x divided by b. ... The cosine. ... The tangent. ... The arcsine. The inverse of sin(x) ... The arccosine. ... The arctangent. ... The exponential base e. ... The natural logarithm...
🌐
Bath
maths.bath.ac.uk › ~zimmer › teaching › matlab › full-manual.pdf pdf
MATLAB MANUAL AND INTRODUCTORY TUTORIALS Ivan Graham,
is the result of applying loge to each entry of the previous vector y. MATLAB handles an infinite answer by · recording it as Inf and producing a warning. (Why is it -Inf?) Note that these calculations verify that ... The simplest plotting command is plot. If x and y are any two vectors of ...
🌐
MathWorks
uk.mathworks.com › matlab › graphics › 2-d and 3-d plots › line plots
loglog - Log-log scale plot - MATLAB
This MATLAB function plots x- and y-coordinates using a base-10 logarithmic scale on the x-axis and the y-axis.