Scalar dot product in sym environment
조회 수: 8 (최근 30일)
이전 댓글 표시
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
답변 (1개)
Sean de Wolski
2015년 7월 13일
편집: Sean de Wolski
2015년 7월 13일
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
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!