15. 数值计算—高数篇
一、求极限
limit(f,x,a)——求极限lim ()x a f x →
limit(f,x,a,'right')——求右极限lim ()x a
f x +→
limit(f,x,a,'left')——求左极限lim ()x a
f x -→
例1求2352
lim sin 53x x x x
→∞++
代码:
syms x;
y=(3*x^2+5)/(5*x+3)*sin(2/x); limit(y,x,inf)
运行结果:ans =6/5
注:Matlab 求二元函数的极限,是用嵌套limit 函数实现的,相当于求的是累次极限,需要注意:有时候累次极限并不等于极限。 例2求30
lim 2x x x
x a b +→??
+ ???
代码:
syms x a b;
y=((a^x+b^x)/2)^(3/x); limit(y,x,0,'right')
运行结果:ans =a^(3/2)*b^(3/2)
二、求导
diff(f,x,n)——求函数f 关于x 的n 阶导数,默认n=1