# Solving trigonometric equation using "solve" function.

10 views (last 30 days)
Hi,
I'm trying to solve trigonometric equation as follows,
230.769*cos(x) + 153.846*sin(x) =1.715.
For this, I'm using the matlab code,
syms x;
solve(230.769*cos(x)+153.846*sin(x) == 1.715, x, 'IgnoreProperties',true, 'ReturnConditions', true);
but, in the answer structure, I couldn't find the values. The ans.x field shows that it hase 2 symbols, but there isn't any value inside them. Can you please help to find what is wrong?
Thank you.

John D'Errico on 2 Jul 2019
Edited: John D'Errico on 2 Jul 2019
Whats the problem? There is no need to set any properties anyway on such a trivial problem.
syms x;
x = solve(230.769*cos(x)+153.846*sin(x) == 1.715, x);
vpa(x)
ans =
2.1526153643152832650062014581097
- 0.97661015722014818434287396730445 - 1.8367099231598242312011508394098e-40i
The second solution is real, it just has an infinitesimal imaginary part.
And of course, you can add any multiple of 2*pi to those solutions.
But even if you do as you did, then LOOK AT THE SOLUTION THAT YOU DID GET. THINK ABOUT IT!
xsol = solve(230.769*cos(x)+153.846*sin(x) == 1.715, x, 'IgnoreProperties',true, 'ReturnConditions', true)
xsol =
struct with fields:
x: [2×1 sym]
parameters: [1×1 sym]
conditions: [2×1 sym]
>> vpa(xsol.x)
ans =
6.283185307179586476925286766559*k + 2.1526153643152832650062014581097
6.283185307179586476925286766559*k - (0.97661015722014818434287396730445 + 1.8367099231598242312011508394098e-40i)
Which says that for integer k, you can add any integer multiple of 2*pi to the solution. I'm pretty sure I said that initially.
xsol.conditions
ans =
in(k, 'integer')
in(k, 'integer')

#### 1 Comment

Biswajit Dipan Biswas on 3 Jul 2019
Thank you so much. I didn't know the application of vpa function. I appreciate your prompt help.