Unable to find explicit solution on vector equation with solve
显示 更早的评论
Hello !
I'm trying to solve static mechanics equations, hence implying vectors.
I tried with a simple case but Matlab is unable to find an explicit solution, though it should be solvable. It seems to me as if there is an error in the code preventing Matlab to properly spot the unknowns (which are vector components).
Here's a minimal code example, with a couple of tries with solve :
syms g mS fS real positive
syms vR_S_1 vR_S_2 vR_S_3 real
vP_S = [0; 0; -mS * g];
vR_S = [vR_S_1; vR_S_2; vR_S_3];
S1 = solve([vP_S + vR_S == zeros(3, 1); vR_S(2)^2 == vR_S(3)^2 * fS^2 - vR_S(1)^2]', [vR_S(3), vR_S(1)])
S2 = solve([vP_S + vR_S == zeros(3, 1); vR_S_2^2 == vR_S_3^2 * fS^2 - vR_S_1^2]', [vR_S_3, vR_S_1])
S3 = solve(subs([vP_S + vR_S == zeros(3, 1); vR_S_2^2 == vR_S_3^2 * fS^2 - vR_S_1^2])', [vR_S_3, vR_S_1])
Any clue about what's going on ?
Many thanks in advance !
采纳的回答
更多回答(1 个)
Walter Roberson
2026-2-26,18:49
编辑:Walter Roberson
2026-2-26,18:51
S1 = solve([vP_S + vR_S == zeros(3, 1); vR_S(2)^2 == vR_S(3)^2 * fS^2 - vR_S(1)^2]', [vR_S(3), vR_S(1)])
You are trying to solve 4 equations for two variables. Most of the time that is going to fail.
1 个评论
Walter Roberson
2026-2-26,20:43
By the way, the ' operator is the complex conjugate operator, not simply the transpose operator which is .' . When you use it the way you are using it, you introduce extraneous solutions.
If you solve vP_S + vR_S == zeros(3, 1) for vR_S then several components come out as zero
类别
在 帮助中心 和 File Exchange 中查找有关 Symbolic Math Toolbox 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!