MATLAB Answers

Empty sym: 0-by-1

조회 수: 11(최근 30일)
Jane Low
Jane Low 2021년 6월 30일
댓글: Jane Low 2021년 7월 3일
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.

답변(1개)

Walter Roberson
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.
  댓글 수: 1
Jane Low
Jane Low 2021년 7월 3일
Thank you, I will try

댓글을 달려면 로그인하십시오.

제품


릴리스

R2021a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by