Empty sym: 0-by-1

4 vues (au cours des 30 derniers jours)
Jane Low
Jane Low le 30 Juin 2021
Commenté : Jane Low le 3 Juil 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.

Réponses (1)

Walter Roberson
Walter Roberson le 30 Juin 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 commentaire
Jane Low
Jane Low le 3 Juil 2021
Thank you, I will try

Connectez-vous pour commenter.

Catégories

En savoir plus sur Symbolic Math Toolbox dans Help Center et File Exchange

Produits


Version

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by