Empty sym: 0-by-1

4 Ansichten (letzte 30 Tage)
Jane Low
Jane Low am 30 Jun. 2021
Kommentiert: Jane Low am 3 Jul. 2021
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.

Antworten (1)

Walter Roberson
Walter Roberson am 30 Jun. 2021
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 Kommentar
Jane Low
Jane Low am 3 Jul. 2021
Thank you, I will try

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Symbolic Math Toolbox finden Sie in Help Center und File Exchange

Produkte


Version

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by