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 › 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
Videos
MathWorks
mathworks.com › matlabcentral › answers › 300133-i-want-to-make-a-function-file-for-finding-log-of-positive-number-to-base-3-how-do-i-do-it
i want to make a function file for finding log of positive number to base 3! how do i do it? - MATLAB Answers - MATLAB Central
August 19, 2016 - https://www.mathworks.com/matlabcentral/answers/300133-i-want-to-make-a-function-file-for-finding-log-of-positive-number-to-base-3-how-do-i-do-it#answer_232230
MathWorks
mathworks.com › matlab › mathematics › elementary math › exponents and logarithms
log10 - Common logarithm (base 10) - MATLAB
This MATLAB function returns the common logarithm of each element in array X.
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.
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 - Matlab log method can be used to compute the natural logarithm or common logarithm of any number. It can also be used to compute the natural logarithm or common logarithm of an array of numbers or a matrix of numbers. Please keep in mind that a natural logarithm has “e” as its base, where “e” represents Euler’s number and has a value of 2.71828, and a common logarithm has 10 as its base.
Call +917738666252
Address Unit no. 202, Jay Antariksh Bldg, Makwana Road, Marol, Andheri (East),, 400059, Mumbai
MathWorks
mathworks.com › matlabcentral › answers › 1808600-formula-for-changing-the-base-of-a-logarithm-is-loga-n-logb-n-logb-a-a-use-matlab-s-fu
formula for changing the base of a logarithm is: loga(N) = (logb(N))/(logb(a)) (a) Use MATLAB's function log (x) to cal... - MATLAB Answers - MATLAB Central
September 20, 2022 - formula for changing the base of a logarithm is:... Learn more about matlab, log
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. ... https://www.mathworks.com/matlabcentral/answers/52224-log-of-10-base-b-where-b-is-defined-as-1-to-10-in-increments-of-1#answer_63659
MathWorks
mathworks.com › matlabcentral › answers › 527923-how-to-find-log-with-base-value
How to find log with base value - MATLAB Answers - MATLAB Central
May 20, 2020 - According to the change of base rule for logarithms, you can use the logarithm function of a specific base to find the logarithm of any base where it is defined. For example ... https://www.mathworks.com/matlabcentral/answers/527923-how-to-find-log-with-base-value#comment_852543
MathWorks
mathworks.com › matlab › mathematics › elementary math › exponents and logarithms
log - Natural logarithm - MATLAB
Y = log(X) returns the natural logarithm ln(x) of each element in array X.
Autarkaw
programming.autarkaw.com › ProgrammingConceptsBook › module-4-math-and-data-analysis.html
Module 4: MATH AND DATA ANALYSIS | Introduction to Programming Concepts with MATLAB
Note the different code used for finding the natural log (Example 1) and the log with a different specified base (Example 2). The functions for natural log, exponential function, and log10 can all be found in Table 1 at the end of this lesson. MATLAB has several trigonometric functions.
Top answer 1 of 5
17
Consider this example:
%# some random data
x = 2.^(0:10);
y = rand(size(x));
plot(log2(x), y) %# plot on log2 x-scale
set(gca, 'XTickLabel',[]) %# suppress current x-labels
xt = get(gca, 'XTick');
yl = get(gca, 'YLim');
str = cellstr( num2str(xt(:),'2^{%d}') ); %# format x-ticks as 2^{xx}
hTxt = text(xt, yl(ones(size(xt))), str, ... %# create text at same locations
'Interpreter','tex', ... %# specify tex interpreter
'VerticalAlignment','top', ... %# v-align to be underneath
'HorizontalAlignment','center'); %# h-aligh to be centered

2 of 5
15
You can plot directly using the plot command
plot (log2(x), y)
but then your x ticks will be the logarithm rather than the actual value. You could either just change your label
xlabel('Log (base 2) of quantity X');
or you can redo the ticks manually.
xt = get(gca, 'XTick');
set (gca, 'XTickLabel', 2.^xt);
Or you can be really fancy
xticks = 10:25;
set(gca, 'XTick', xticks);
for j = 1:length(xticks)
xtl{j} = ['2^' num2str(xticks(j))];
end
set(gca, 'XTickLabel', xtl)
which will evenly space the tick marks on the log scale, and label them according to their power of 2
Quora
quora.com › How-do-I-use-natural-logarithm-ln-in-matlab
How to use natural logarithm (ln) in matlab - Quora
You can use directly log(x) in MATLAB to do this . If you want to use logarithm of x to the base 10, you need to use log10(x).
MathWorks
mathworks.com › matlabcentral › answers › 282038-how-to-draw-a-log-function
How to draw a log function? - MATLAB Answers - MATLAB Central
May 1, 2016 - y = 10^(log10(y)) = 10^(1+log10(x)) = (10^1)*(10^log10(x)) = 10*x ... Not correct, I'm afraid, I tried this, however obviously z and y are identical and nonlinear! ... Again, I'm trying to do this in matlab, help! ... Hey, no fair, Ahmad! You slipped in a factor of 1.75 on your trial. You have 10.^(-.3+1.75*log10(x)) instead of your original 1+log10(x).