필터 지우기
필터 지우기

Error with matrix structure

조회 수: 1 (최근 30일)
Cheng Yoong
Cheng Yoong 2011년 12월 3일
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
Amith Kamath
Amith Kamath 2011년 12월 4일
I get the same results, although a simple substitution reveals that the second solution is correct too. Good question!

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

답변 (1개)

Walter Roberson
Walter Roberson 2011년 12월 4일
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
Cheng Yoong
Cheng Yoong 2011년 12월 5일
Means there is no way to solve this? Or install older version can solve this problem?

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

카테고리

Help CenterFile Exchange에서 Numeric Solvers에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by