Error with matrix structure

1 visualizzazione (ultimi 30 giorni)
Cheng Yoong
Cheng Yoong il 3 Dic 2011
The following equation was taken from a textbook:
6 = 4cosθ1 + 3cos(θ1+θ2)
2 = 4sinθ1 + 3sin(θ1+θ2)
and the book suggested to solve the unknown θ1 and θ2 using following command:
>>S =
solve('4*cos(th1)+3*cos(th1+th2)=6','4*sin(th1)+3*sin(th1+th2)=2')
S =
th1:[2x1 sym]
th2:[2x1 sym]
>>double(S.th1)*(180/pi)
ans =
-3.2981
40.1680
>>double(S.th2)*(180/pi)
ans =
51.3178
-51.3178
I did the same thing in Matlab but the matrix detected is as following:
S =
th1:[1x1 sym]
th2:[1x1 sym]
which gives me only one solution for th1 and th2. Anyone can tell me what's the problem?
  1 Commento
Amith Kamath
Amith Kamath il 4 Dic 2011
I get the same results, although a simple substitution reveals that the second solution is correct too. Good question!

Accedi per commentare.

Risposte (1)

Walter Roberson
Walter Roberson il 4 Dic 2011
Recall that the symbolic toolbox used to use Maple and in newer versions uses MuPAD; this can lead to differences in solutions.
My observation is that in general MuPAD was weaker on finding roots of polynomials, but I have seen evidence that that has improved substantially in very recent versions.
When I try the equation in Maple, I get:
th1 = arctan((1/16) * RootOf(10*_Z^2-95-94*_Z), 47/48-(1/48) * RootOf(10*_Z^2-95-94*_Z))
th2 = -arctan(-47/45+(2/9)*RootOf(10*_Z^2-95-94*_Z))
which would appear at first glance to be a single solution. When, however, you examine the RootOf() you will note that they are roots of a quadratic and this each RootOf() stands for 2 solutions. When Maple's allvalues() operation is used, the solution expands to
th1 = arctan((-47-9*sqrt(39))/(-141+3*sqrt(39)))
th2 = -arctan((1/5)*sqrt(39))
th1 = arctan((47-9*sqrt(39))/(141+3*sqrt(39)))
th2 = arctan((1/5)*sqrt(39))
which comes out at the expected angles.
Note for this purpose that using double() or the symbolic eval() will only extract the "principle root" of the RootOf() structure, and so would only give one solution. I do not know what MuPad's equivalent to Maple's allvalues() function is.
  1 Commento
Cheng Yoong
Cheng Yoong il 5 Dic 2011
Means there is no way to solve this? Or install older version can solve this problem?

Accedi per commentare.

Tag

Community Treasure Hunt

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

Start Hunting!

Translated by