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!

