Empty sym: 0-by-1
4 次查看(过去 30 天)
显示 更早的评论
How to solve the five equations below?
cos(5*a)+cos(5*b)+cos(5*c)+cos(5*d)+cos(5*e)==0
cos(7*a)+cos(7*b)+cos(7*c)+cos(7*d)+cos(7*e)==0
cos(11*a)+cos(11*b)+cos(11*c)+cos(11*d)+cos(11*e)==0
cos(13*a)+cos(13*b)+cos(13*c)+cos(13*d)+cos(13*e)==0
cos(1*a)+cos(1*b)+cos(1*c)+cos(1*d)+cos(1*e)==4
Ans:
a = 6.57 degree = 0.1146681 rad
b = 18.94 degree = 0.33056536 rad
c = 27.18 degree = 0.47438049 rad
d = 45.14 degree = 0.78784162 rad
e = 62.24 degree = 1.0862929 rad
Hereby my code
syms a b c d e
sol = vpasolve( ...
cos(5*a)+cos(5*b)+cos(5*c)+cos(5*d)+cos(5*e)==0, ...
cos(7*a)+cos(7*b)+cos(7*c)+cos(7*d)+cos(7*e)==0, ...
cos(11*a)+cos(11*b)+cos(11*c)+cos(11*d)+cos(11*e)==0, ...
cos(13*a)+cos(13*b)+cos(13*c)+cos(13*d)+cos(13*e)==0, ...
cos(1*a)+cos(1*b)+cos(1*c)+cos(1*d)+cos(1*e)==4, ...
[a,b,c,d,e],[0, pi; 0, pi; 0, pi; 0, pi; -pi, pi]);
sol.a
sol.b
sol.c
sol.d
sol.e
The output is as shown:
ans =
Empty sym: 0-by-1
ans =
Empty sym: 0-by-1
ans =
Empty sym: 0-by-1
ans =
Empty sym: 0-by-1
ans =
Empty sym: 0-by-1
Thank you.
0 个评论
回答(1 个)
Walter Roberson
2021-6-30
You will not be able to proceed that way, in practice.
In practice, you need to eliminate at least 3 variables first. The resulting 4th and 5th equations are very complex, and not symbolically tractable. So at that point you switch to vpasolve() over two variables . And then you back-substitute.
You might need to attempt several different starting points for vpasolve(), but doing a grid search over 2 variables is a lot easier than doing a grid search over 5 variables.
Once you have numeric values for two of the variables, you back substitute to get the other three.
Somewhere buried in my postings you will find code I did for this kind of problem.
Let's see... with three variables I did https://www.mathworks.com/matlabcentral/answers/394893-solving-trigonometric-non-linear-equations-in-matlab?s_tid=prof_contriblnk
Related: https://www.mathworks.com/matlabcentral/answers/593413-how-can-we-solve-non-linear-equations-like-this-via-matlab-i-am-trying-to-solve-it-by-using-followi and https://www.mathworks.com/matlabcentral/answers/376008-how-to-add-a-less-than-constraint-condition-to-solve-the-transcendental-equation
另请参阅
类别
在 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!