正在加载图片...
>>diff(f)%differentiate with respect to the default variable x 3*a*x^2+2*x-b >>diff(f, 'a)% differentiate with respect to a >>diff(f, 2)% differentiate twice with respect to x 6*a*x+2 >>diff(f,'a, 2)% differentiate twice with respect to a ans- 函数df可对数组进行运算。如果F是符号向量或数组,d(对数组内的各个元素进行 微分 >F=sym([a*x, b*x2: c*x3, d*s] ) create a symbolic array >>diff(F)% differentiate the element with respect to x X 0] 注意函数d用在 MATLAB,计算数值向量或矩阵的数值差分。对于一个数值向量或矩 阵M,difM计算M2:m,:)-M(1:m-1,:)的数值差分,如下所示 m=(1: 8). 2)% create a vector M= >>diff(m)% find the differences between elements ans- 579>> diff(f) % differentiate with respect to the default variable x ans= 3*a*x^2+2*x-b >> diff(f,'a ') % differentiate with respect to a ans= x^3 >> diff(f,2) % differentiate twice with respect to x ans= 6*a*x+2 >> diff(f,' a ',2) % differentiate twice with respect to a ans= 0 函数diff也可对数组进行运算。如果F是符号向量或数组,diff(F)对数组内的各个元素进行 微分。 >> F=sym(' [a*x, b*x^2; c*x^3, d*s] ') % create a symbolic array F= [ a*x, b*x^2] [c*x^3, d*s] >> diff(F) % differentiate the element with respect to x ans= [ a,2*b*x] [3*c*x^2, 0] 注意函数diff也用在MATLAB,计算数值向量或矩阵的数值差分。对于一个数值向量或矩 阵M,diff(M)计算M(2: m,: )-M(1: m-1,: )的数值差分,如下所示: >> m=[(1: 8).^2)] % create a vector M= 1 4 9 16 25 36 49 64 >> diff(M) % find the differences between elements ans= 3 5 7 9 11 13 15
<<向上翻页向下翻页>>
©2008-现在 cucdc.com 高等教育资讯网 版权所有