Hi everyone, I’m new to Julia so maybe the problem that I’ve anecountered is preatty trivial.
Basically I have two main problem with the simple symbolic equation expressing the kinetic energy of a rigid body satellite.
- FIrst: I don’t know how to multiplicate a symbolic value by a scalar one.
- Second: the code part with: omega’(RIc*R’)*omega trows an error telling me that it is ambigous and here I got stucked and I’ve not found a solution so far.
Hereafter I share my code. Thx in advance for any answer.
Davide
using DifferentialEquations
using ModelingToolkit
@parameters I[1:3,1:3] mc[1,1] mu[1,1]
@variables t r[1:3,1](t) angle[1:3,1](t)
D = Differential(t)
R= [cos(angle[1]).*cos(angle[3])-cos(angle[2]).*sin(angle[1]).*sin(angle[3]) sin(angle[1]).*cos(angle[3])+cos(angle[2]).*cos(angle[1]).*sin(angle[3]) sin(angle[2]).*sin(angle[3])
-cos(angle[1]).*sin(angle[3])-cos(angle[2]).*sin(angle[1]).*cos(angle[3]) -sin(angle[1]).*sin(angle[3])+cos(angle[2]).*cos(angle[1]).*cos(angle[3]) sin(angle[2]).*cos(angle[3])
sin(angle[2]).*sin(angle[3]) -sin(angle[2]).*cos(angle[1]) cos(angle[2])]
d_angle = D(angle)
v = D(r)
omega = [d_angle[2].*cos(angle[1])+d_angle[3].*sin(angle[2]).*sin(angle[1])
d_angle[2].*sin(angle[1])-d_angle[3].*sin(angle[2]).*cos(angle[1])
d_angle[1]+d_angle[3].*cos(angle[2])]
Tc = 0.5 *v'*(mc*v) + 0.5*omega'*(R*Ic*R')*omega