标签:
在matlab中求导要进行符号运算。
>>syms x;
>>y = x^cos(x);
>>ydot = diff(y, x, 1);%对x求一阶导数
ydot = x^(cos(x) - 1)*cos(x) - x^cos(x)*log(x)*sin(x)
>> y2dot = diff(y, x, 2)%求二阶导数,求n阶导数同理。
y2dot = cos(x)*(x^(cos(x) - 2)*(cos(x) - 1) - x^(cos(x) - 1)*log(x)*sin(x)) - x^(cos(x) - 1)*sin(x) - log(x)*sin(x)*(x^(cos(x) - 1)*cos(x) - x^cos(x)*log(x)*sin(x)) - x^cos(x)*cos(x)*log(x) - (x^cos(x)*sin(x))/x
>> subs(ydot, x, pi)%将x = pi带入ydot
ans =
-0.101321183642338
标签:
原文地址:http://www.cnblogs.com/jiangkejie/p/5929657.html