matlab求极限含有对数?

来源:百度知道 编辑:UC知道 时间:2024/06/06 22:30:37
x趋于零。
syms x a
limit((loga(1+x))/x)
结果出现这样的错误,请问我该怎么修改程序?
??? Undefined function or method 'loga' for input arguments of type 'sym'.

运行的正确结果应该是1/log(a)
后来有位朋友之指点,如下修改程序,她能运行,而我让然无法运行,出项下面的错误
>> syms x a
>> limit((log(x+1)/log(a))/x,0)
??? Error using ==> subsindex
Function 'subsindex' is not defined for values of class 'sym'.

>> which sundindex
'sundindex' not found.
请各位兄弟帮我解答?

Matlab中提供了极限运算函数limit,但是是符号运算

还有Matlab中的对数函数,与我们数学上使用的不一样

log()表示数学上的ln,就是常数对数
log10()表示数学上的lg,就是10的对数
log2()表示数学上2的对数

Matlab中只提供了上面三个,没有提供其他,其他的要使用换地公式转化,比如log3(x+5)表示为log(x+5)/log(3)

故你的问题的Matlab解答为

syms x a
%表示求在x=0出的对数
limit((log(1+x)/log(a))/x,0)

ans =

1/log(a)

http://www.matlabsky.com/viewthread.php?tid=736