Error "()-indexing must appear last in an index expression" in symbolic Matlab Toolbox

1 回表示 (過去 30 日間)
paco ocap
paco ocap 2016 年 8 月 17 日
編集済み: Mischa Kim 2016 年 8 月 25 日
Hello everyone, I want to operate with some symbolic expressions and their derivatives, but I'm finding some problems when trying to do something like this:
>>syms x(t)
>>q=diff(x,t)+2
q(t) =
D(x)(t) + 2
>>dq=diff(q,D(x)(t))
Error: ()-indexing must appear last in an index expression.
I want to differentiate q(t) with respect to the derivative of x(t), and I was wondering if there is any way to do this without substituting D(x)(t) for another variable
  2 件のコメント
KSSV
KSSV 2016 年 8 月 17 日
what you want to do actually?
paco ocap
paco ocap 2016 年 8 月 17 日
I want to solve Lagrange equations for any given lagrangian. And as I have many variables, and I dont know which of them is differentiated or not at first, I think it would be easier to solve things following the process showcased in the question. But if it is not possible, I will try to do it another way.

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

回答 (1 件)

Mischa Kim
Mischa Kim 2016 年 8 月 25 日
編集済み: Mischa Kim 2016 年 8 月 25 日
Paco, check out the Euler-Lagrange tool on File Exchange. It does exactly what you are trying to do.

Community Treasure Hunt

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

Start Hunting!

Translated by