3.2 微积分 3.2.1 极限
例: >>limit(1/x,x,0) ans = NaN >>limit(1/x,x,0, 'left') ans = -inf >>limit(1/x,x,0, 'right') ans = inf 3.2.2 微分
如: >>f=sym('a*x^2+b*x+c') >>diff(f) % 对默认自变量x求微分 ans = 2*a*x+b >>diff(f,a) % 对a求微分 ans = x^2 >>diff(f,2) % 对x求二次微分 ans = 2*a >>diff(f,a,2) % 对a求二次微分 ans =
3.2.3 积分
如: >>int(f) %表达式f的不定积分,自变量是x ans = 1/3*a*x^3+1/2*b*x^2+c*x >>int(f,x,0,2) %表达式f在(0,2)的定积分,自变量是x ans = 8/3*a+2*b+2*c >>int(int(f,a),x) ans = 1/6*a^2*x^3+1/2*b*a*x^2+c*a*x 函数的积分可能不存在,当MATLAB不能找到积分时,它将返回该函数表达式。如: >>int('x/exp(x^3)') Warning: Explicit integral could not be found. In d:\matlab\toolbox\symbolic\@sym\int.m at line 58 In d:\matlab\toolbox\symbolic\@char\int.m at line 9 ans = int(x/exp(x^3),x) 3.2.4 级数
例如: >>syms k >>symsum(1/k,k,1,inf) %1+1/2+1/3+…+1/k+… ans = inf >>taylor(sin(x),10) %求sin(x)的泰勒级数展开 ans = x-1/6*x^3+1/120*x^5-1/5040*x^7+1/362880*x^9 |
|