Scalar dot product in sym environment
8 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
I am working on a nonlinear dynamics mechanism using the Euler-Lagrangian for derivation of the equation of motion.
I am using the symbolic toolbox to deal with all of the nasty differentiation involved and for a part of this derivation it would be highly convenient to take the scalar dot product of two of my [2x1] syms.
Matlab gives the following error:
Error using dot (line 33) A and B must be same size.
Error in BistableDerivation (line 51) Q1 = dot(F1, simplify(diff(r1,x1))) + dot(F2, simplify(diff(r2,x1))) ...
From my workspace: F1 is a 2x1 sym (I have not yet given values to this vector, assignment was made by F1 = sym('F1',[2 1]);) r1 is a 2x1 sym x1 is a 1x1 sym
simplify(diff(r1, x1)) also definitely returns a 2x1 sym
Any help would be thoroughly appreciated - I know I could manually write the dot product out, however this statement continues and a dot product really would be ideal here.
0 commentaires
Réponses (1)
Sean de Wolski
le 13 Juil 2015
Modifié(e) : Sean de Wolski
le 13 Juil 2015
dot product of two 2x1 syms works for me:
syms x y q z
XY = [x;y]
QZ = [q;z]
dot(XY,QZ)
q*conj(x) + z*conj(y)
Break apart the pieces and figure out which one is returning an unexpected size.
0 commentaires
Voir également
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!