Solve Equation numerically for variable
1 回表示 (過去 30 日間)
古いコメントを表示
Need to solve this problem for w:
0 = A + Bcos(w) + Ccos(w) ( A,B,C Constants)
Bounds should be 0-180 for this problem I believe, two solutions possible?
0 件のコメント
回答 (2 件)
Star Strider
2016 年 7 月 21 日
If ‘A’, ‘B’ and ‘C’ are matrices, then:
w = acos(-(B+C)\A);
assuming that the matrices have the appropriate dimensions, and the resulting argument matrix ‘(-(B+C)\A)’ elements are all between -1 and +1.
2 件のコメント
Star Strider
2016 年 7 月 21 日
The Symbolic Math Toolbox comes up with these solutions for ‘w’ that would also work for matrices:
syms A B C w
w_sol = solve(A == B*cos(w) + C*sin(w), w);
w_sol = simplify(w_sol, 'steps',10)
-log((A + (A^2 - B^2 - C^2)^(1/2))/(B - C*1i))*1i
-log((A - (A^2 - B^2 - C^2)^(1/2))/(B - C*1i))*1i
Use the sqrtm and logm functions. Also see the funm function. If you know that your matrices will always be real or positive, you can tell the Symbolic Math Toolbox to assume that. It may simplify the result.
参考
カテゴリ
Help Center および File Exchange で Symbolic Math Toolbox についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!