eqn =

syms z(t) theta(t) r

eqn = z(t)-r*sin (theta(t)) == 0

z(t) = rhs(isolate(eqn,z(t)))

1 view (last 30 days)

Show older comments

Duncan Carlsmith
on 28 May 2024

Commented: Duncan Carlsmith
on 30 May 2024

I am testing out MATLAB FunctionalDerivative for generating and solving Euler equations derived from a Laargrangian with a holonomic resulting in functional equations. I want to combine these. When for example I try to solve the result of the functional derivative dL/d\lambda = z(t)-r*sin (theta(t)) = 0 for z(t)=r*sin(theta(t)) using solve, I can't do it. Other examples which I've followed and which work are to define symbolic variables not sym functions for functions of time and additonall for their derivatives which is cumbersome. The tutorial https://www.mathworks.com/help/symbolic/functional-derivative.html uses children of the equations which I don't quite understand to separate bits in an equality but this doesn't serve if says one has a not trivial relationship between functions.

Any suggestions?

Just to illustrate solve for variables working and for functions failing:

The following code gives an error in the last line:

clear all

syms a b

solve(a+b==0,a)

ans = b

syms c(t) d(t)

Warning: Can only make assumptions on variable names, not 'c(t)'.

Warning: Can only make assumptions on variable names, not 'd(t)'.

S=solve(c(t)+d(t)==0,c)%,"ReturnConditions",true)

S =

Empty sym: 0-by-1

Paul
on 28 May 2024

syms z(t) theta(t) r

eqn = z(t)-r*sin (theta(t)) == 0

z(t) = rhs(isolate(eqn,z(t)))

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

Start Hunting!