numerically solve equation sets with given inputs range

% The solution set: theta1, theta2, theta3 and theta4 are variables [0, 2pi]
% Numerical solving 9 following equationa in a system containing only 4 variables equations
cos(theta1)*cos(theta2)-sin(theta3)*sin(theta4)*0.44 = 0;
-cos(theta1)*sin(theta2)*0.8-0.5*cos(theta3)*0.3*sin(theta4) = 0;
0.7 * sin(theta3) * cos(theta4) + 0.45 * cos(theta2) + sin(theta1) = 0;
cos(theta1)*cos(theta2)+sin(theta3)*sin(theta4)*0.8 = 0;
0.4 * sin(theta1) * cos(theta4) + 0.45 * cos(theta2)= 0;
0.2 * cos(theta3) * cos(theta2) + 0.45 * cos(theta2) + sin(theta1)= 0;
0.45 * sin(theta4) * cos(theta2) + 0.45 * cos(theta2)= 0;
0.15 * sin(theta3) * cos(theta1) + 0.45 * cos(theta2) + sin(theta1)= 0;
0.37 * sin(theta2) * cos(theta4) + 0.45 * cos(theta2)=0;
% parameters are given in a random pattern just for example
% Each equation of the system is the expression of theta1, theta2, theta3, and theta4

回答 (2 件)

madhan ravi
madhan ravi 2018 年 12 月 27 日

0 投票

syms theta1 theta2 theta3 theta4
e1=cos(theta1)*cos(theta2)-sin(theta3)*sin(theta4)*0.44 == 0;
e2=-cos(theta1)*sin(theta2)*0.8-0.5*cos(theta3)*0.3*sin(theta4) == 0;
e3=0.7 * sin(theta3) * cos(theta4) + 0.45 * cos(theta2) + sin(theta1) == 0;
e4=cos(theta1)*cos(theta2)+sin(theta3)*sin(theta4)*0.8 == 0;
e5=0.4 * sin(theta1) * cos(theta4) + 0.45 * cos(theta2)== 0;
e6=0.2 * cos(theta3) * cos(theta2) + 0.45 * cos(theta2) + sin(theta1)== 0;
e7=0.45 * sin(theta4) * cos(theta2) + 0.45 * cos(theta2)== 0;
e8=0.15 * sin(theta3) * cos(theta1) + 0.45 * cos(theta2) + sin(theta1)== 0;
e9=0.37 * sin(theta2) * cos(theta4) + 0.45 * cos(theta2) == 0;
[theta1,theta2,theta3,theta4]=vpasolve([ e1, e2, e3, e4, e5, e6, e7, e8, e9],theta1,theta2,theta3,theta4)
Gives:
More equations than variables is only supported for polynomial systems.

2 件のコメント

Image Analyst
Image Analyst 2018 年 12 月 27 日
Would using syms count as numerically solving? I think of syms as more of an analytical or formulaic type of solution rather than a numerical one.
madhan ravi
madhan ravi 2018 年 12 月 27 日
編集済み: madhan ravi 2018 年 12 月 27 日
Well yes if you read https://www.mathworks.com/help/symbolic/vpasolve.html it’s clearly stated. People always think when a syms at the very beginning is used it doesn’t mean that the problem is controlled analytically there are several ways to manipulate them .Generally I see people bashing Symbolic Math Toolbox , I mean what’s the point ?? (agree when an analytical solution can’t be found then it can be numerically approximated), people who develop that toolbox don’t do it because they have lot of free time , they do it for a purpose. Children in the early stages of school are taught analytical formulas in order to understand the basic ground reason of a problem. Scientists in ancient days didn’t solve a problem with computers they proved everything analytically. If it wasn’t a sake of analytical solution was found no one in this world would understand a simple math.

サインインしてコメントする。

Walter Roberson
Walter Roberson 2018 年 12 月 27 日

0 投票

There is no consistent set of solutions for all 9 equations together. There are solutions involving 8 of the 9 equations (possibly different solutions depending on the subsets chosen.) The second equation is particular trouble; if you solve it first then the 9th becomes the problem.

質問済み:

2018 年 12 月 27 日

回答済み:

2018 年 12 月 27 日

Community Treasure Hunt

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

Start Hunting!

Translated by