Solving trigonometric equation using "solve" function.
127 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Biswajit Dipan Biswas
il 2 Lug 2019
Modificato: Torsten
il 15 Apr 2023
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.
0 Commenti
Risposta accettata
John D'Errico
il 2 Lug 2019
Modificato: John D'Errico
il 2 Lug 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')
Più risposte (1)
Jaimin amin
il 15 Apr 2023
sol=solve({-sin[t2+t3]-sin[t2]==-1.5 && cos[t2+t3]+cos[t2]==0.8660},{t2,t3})
Vedere anche
Prodotti
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!