1. 公式推导
以求函数的导函数为例。
1. 已知表达式
已知 x = t 2 x=t^2 x=t2, y = x 2 y=x^2 y=x2,求 y y y对 t t t的导数:
>> clear
>> syms x t;
>> x=t^2;
>> y=x^2;
>> dy=diff(y,t);
>> latex(dy)
ans =
'4\,t^3'
>>
将公式代码复制到 Markdown 格式如下:
4 t 3 4\,t^3 4t3
2. 未知表达式
已知 x = f ( t ) x=f(t) x=f(t), y = x 2 y=x^2 y=x2,求 y y y对 t t t的导数:
>> clear
>> syms x t;
>> x = str2sym('x(t)');
>> y=x^2;
>> df=diff(y,t);
>> latex(df)
ans =
'2\,x\left(t\right)\,\frac{\partial }{\partial t} x\left(t\right)'
>>
将公式代码复制到 Markdown 格式如下:
2 x ( t ) ∂ ∂ t x ( t ) 2\,x\left(t\right)\,\frac{\partial }{\partial t} x\left(t\right) 2