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x^2+s_y^2+s_z^2+2*l3y*o_1y+2*l3z*o_1z-2*o_1x*p4x-2*l3y*p4y-2*o_1y*p4y-2*l3z*p4z+2*l3x*(o_1x-p4x-s_x)-2*o_1x*s_x+2*p4x*s_x-2*l3y*s_y-2*o_1y*s_y+2*p4y*s_y-2*l3z*s_z+2*p4z*s_z)+c2*c3^2*(l1^2-l4^2+l3x^2+l3y^2+l3z^2+p4x^2+p4y^2+p4z^2+s_x^2+s_y^2+s_z^2-2*l3y*o_1y+2*l3z*o_1z-2*o_1x*p4x+2*l3y*p4y-2*o_1y*p4y-2*l3z*p4z-2*o_1x*s_x+2*p4x*s_x+2*l3x*(-o_1x+p4x+s_x)+2*l3y*s_y-2*o_1y*s_y+2*p4y*s_y-2*l3z*s_z...
+2*p4z*s_z)+c2^3*(l1^2-l4^2+l3x^2+l3y^2+l3z^2+p4x^2+p4y^2+p4z^2+s_x^2+s_y^2+s_z^2+2*l3y*o_1y-2*l3z*o_1z-2*o_1x*p4x-2*l3y*p4y-2*o_1y*p4y+2*l3z*p4z-2*o_1x*s_x+2*p4x*s_x+2*l3x*(-o_1x+p4x+s_x)-2*l3y*s_y-2*o_1y*s_y+2*p4y*s_y+2*l3z*s_z+2*p4z*s_z)-2*c2^2*c3*(o_1z*(p4y+s_y)+2*l3z*(-o_1y+p4y+s_y)+2*l3y*(-o_1z+p4z+s_z))+c2^2*(4*l3z*(o_1x-p4x-s_x)-2*l3x*(o1z-2*(p4z+s_z)))];
Error using ^
Matrix must be square.
why?
댓글 수: 0
채택된 답변
Rik
2021년 12월 22일
Lets take a third power as example.
A is n by m
A^3 = A*A*A = [n x m]*[n x m]*[n x m]
To be compatible, adjacent sizes must be equal
Therefore, for this operation to be valid, n and m must be equal
If instead you meant element-wise operations, you should replace all matrix operation with the other version. That means replacing every * with .* and every ^ with .^ (plus and minus will always work element-wise).
I hope this formula was generated procedurally and not written by hand, because that would be a nightmare to debug. Especially with all those numbered variables, instead of arrays.
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Logical에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!