solving equations with trigonometric functions
이전 댓글 표시
Hi, I have been trying to solve the following equations for the variables theta3 and theta4. So I wrote the code as seen below.
syms x1 x2 x3 x4 x5 x6 theta2 theta3 theta4 Ad Dd
theta2 = 119.92
x1 = 135
x2 = 25
x5 = 120
x6 = 35
Ad = 110.49467458
Dd = 9.5869687
eqn1 = x1*cos(theta2) + x2*sin(theta2) + x5*cos(theta3) -x6*cos(theta4) - Ad == 0
eqn2 = x1*sin(theta2) -x2*cos(theta2) - x5*sin(theta3) -x6*sin(theta4) - Dd ==0
S1 = solve(eqn1,eqn2)
But my output looks like this
S1 =
theta3: [2×1 sym]
theta4: [2×1 sym]
Does anyone know how do I get the answer in degrees?
I'm fairly new to Matlab, so I'm sorry if this an extremely basic question.
Regards, Harshith
댓글 수: 4
darova
2021년 4월 5일
I think fsolve can be better for this task. Can you explain the problem you get this equations from? Maybe there is a better way to calculate
and 
Harshith Mahesh
2021년 4월 6일
John D'Errico
2021년 4월 6일
You will need to seriously look at both the equations you have written, as well as the constants, since no real solution exists to the problem you have psosed. See my answer.
Bruno Luong
2021년 4월 6일
theta2 = 119.92
degree or radian?
Do you know sin/cos argument is radian?
채택된 답변
추가 답변 (2개)
J Chen
2021년 4월 5일
format long % show more digits
double(S1.theta3)
double(S1.theta4)
format % back to the default format
댓글 수: 1
John D'Errico
2021년 4월 6일
While this is correct as an answer, the problem itself has some major caveats that would need to be addressed. See my answer for a discussion of the problems.
darova
2021년 4월 6일
0 개 추천
Here is the similar example. Maybe you will be interested
,
,
and
length are given.
angle is changing- Calculate length
and 
- Calculate
vector - Rotate
by
degree, make it of
length

See code attached
카테고리
도움말 센터 및 File Exchange에서 Formula Manipulation and Simplification에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

