Questing about symbolic differentiation, inner derivative

2 ビュー (過去 30 日間)
Per
Per 2014 年 2 月 5 日
コメント済み: Walter Roberson 2014 年 2 月 5 日
Hi everybody,
I am doing a project that requires alot of symbolic differentiation. I need to differentiate expression like cos(theta(t)) w.r.t t, is this possible with matlab? If so, how?
I know that I could easily do this with mathematica but I am also using simulink, so it would be easier just to use one software.
BR,
Per

採用された回答

Walter Roberson
Walter Roberson 2014 年 2 月 5 日
Yes, the Symbolic Toolbox can handle that without difficulty. The syntax would go something like
syms theta(t) t
diff(cos(theta(t))

その他の回答 (1 件)

Per
Per 2014 年 2 月 5 日
Walter,
Thank you for the fast answer. Can I extend this syntax to vectors of symbols?
BR,
Per
  1 件のコメント
Walter Roberson
Walter Roberson 2014 年 2 月 5 日
You can differentiate a vector of expressions, but you cannot differentiate with respect to a vector. If what you are looking for is the partial derivatives then you can use the syntax
diff(F,var1,...,varN) differentiates F with respect to the variables var1,...,varN.
but you cannot use diff(f,[var1, var2, var3... varn])
What you can do in MATLAB is
varvec = [var1, var2, var3... varn]; %however it got built
T = num2cell(varvec); %convert to cell array
diff(F, T{:})
the T{:} syntax expands the cell array to become individual arguments to the call.

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

カテゴリ

Help Center および File ExchangeCalculus についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by