Partial Derivative of Function with respect to another Function

Howdy,
syms t q1(t) q2(t);
% define q1 and q2
q1 = q1(t)
q2 = q2(t)
% define a new function
q1_dot = diff(q1)
f = 5*(q1_dot)^2 + q2
diff_f_q1Dot = diff(f) ./ diff(q1_dot)
If I have the following lines of code, I would expect my output to be: 10*q1_dot, but instead I get:
matlabPartialDerive.PNG
Any Ideas as to what I am doing wrong? Maybe this is not the correct chain rule approach.

回答 (1 件)

Walter Roberson
Walter Roberson 2019 年 9 月 9 日

0 投票

expand(diff_f_q1Dot) to get
diff(q2(t), t)/diff(q1(t), t, t) + 10*diff(q1(t), t)
It is invalid to claim that the derivative of an unknown function with respect to a different unknown function will always be 0. For the derivative to be 0, the functions would have to be independent, but we cannot know that for unknown functions.

2 件のコメント

Gabriel Entov
Gabriel Entov 2019 年 9 月 9 日
Hi Walter,
I understand that, as these functions are symbolic. So is there no way to get 10*q1_dot on its own?
Thank you very much!
Walter Roberson
Walter Roberson 2019 年 9 月 9 日
You could use children().
There are also some new facilities for extracting parts of an expression as of r2019a that I have a hard time remembering the names of.

サインインしてコメントする。

カテゴリ

ヘルプ センター および File ExchangeNumerical Integration and Differential Equations についてさらに検索

質問済み:

2019 年 9 月 9 日

コメント済み:

2019 年 9 月 9 日

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by