The log function does exactly what you want. log(14 - y) If you want a base 10 log, you use log10. There is also a log2 function, which gives a base 2 log. Other bases are achieved using the simple relation log(X)/log(b) produces a log to the base b. You could write a function for it as: logb = @(X,b) log(X)/log(b); logb(9,3) ans = 2 which is as expected. Finally, there is the reallog function, which also does the natural log, but it produces an error when the log would have been a complex number. log(-2) ans = 0.693147180559945 + 3.14159265358979i reallog(-2) Error using reallog Reallog produced complex result. But for the more normal case, reallog does the same thing as log. log(2) ans = 0.693147180559945 reallog(2) ans = 0.693147180559945 Answer from John D'Errico on mathworks.com
🌐
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 › fileexchange › 14866-logb
logb - File Exchange - MATLAB Central
September 1, 2016 - Examples: 1) To calculate the base 5 logarithm of 3: y = logb(3,5) 2) To calculate element-wise the log of a non-scalar input using different bases: y = logb(magic(3),[1 2 3; 4 5 6; 7 8 9]); See also: log, log10, log2 · Brett Shoelson (2025). logb (https://www.mathworks.com/matlabcentral/fileexchange/14866-logb), MATLAB Central File Exchange.
🌐
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
log10 - Common logarithm (base 10) - MATLAB
Y = log10(X) returns the common logarithm of each element in array X. The function accepts both real and complex inputs. For real values of X in the interval (0, Inf), log10 returns real values in the interval (-Inf ,Inf). For complex and negative real values of X, the log10 function returns ...
Find elsewhere
🌐
EDUCBA
educba.com › home › data science › data science tutorials › matlab tutorial › matlab log
Matlab log | Learn the different examples of Matlab log
March 8, 2023 - This is how our input and output will look like in the Matlab command window: ... As we can see in the output, we have the log of 4 to the base “e” as 1.3863, which is the same as expected by us.
Address   Unit no. 202, Jay Antariksh Bldg, Makwana Road, Marol, Andheri (East),, 400059, Mumbai
🌐
Quora
quora.com › How-can-I-implement-log-ln-and-e-in-MATLAB
How to implement log, ln, and e in MATLAB - Quora
MATLAB already provides the standard ... environments), here are concise, reliable approaches. ... Natural log: log(x) returns ln(x) (base e)....
🌐
MathWorks
mathworks.com › matlabcentral › answers › 52224-log-of-10-base-b-where-b-is-defined-as-1-to-10-in-increments-of-1
Log of 10 base "b" where 'b' is defined as 1 to 10 in increments of 1 - MATLAB Answers - MATLAB Central
October 29, 2012 - It is for school BTW, and all i know is Log(base'b')(X)=log(base'e')(x) over log(base'b'(b) where be is all values between 1-10. Sign in to comment. Sign in to answer this question.
🌐
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.
🌐
Johns Hopkins University
math.jhu.edu › ~shiffman › 370 › help › techdoc › ref › log10.html
log10 (MATLAB Function Reference)
Description The log10 function operates element-by-element on arrays. Its domain includes complex numbers, which may lead to unexpected results if used unintentionally. Y = log10(X) returns the base 10 logarithm of the elements of X.