Empty sym: 0-by-1
조회 수: 9 (최근 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에서 Equation Solving에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!