Solving an equation containing sine and cosine

5 visualizaciones (últimos 30 días)
Hamish
Hamish el 14 de Ag. de 2012
Respondida: Cheng Chen el 26 de Sept. de 2020
This might sound silly, so please be patient. I am not a complete beginner at Matlab but I seem to be stuck with this small problem: How do I solve for x? The equation is
A*cos(x)+B/sin(x)=C where A,B and C are constants
Thanks in advance.

Respuesta aceptada

Matt Fig
Matt Fig el 14 de Ag. de 2012
If you have the symbolic toolbox, use SOLVE:
solve('A*cos(x)+B/sin(x)=C','x')
  1 comentario
Hamish
Hamish el 14 de Ag. de 2012
Yes, of course. Thank you so much. I knew this earlier but somehow completely forgot about it and was frustrating.

Iniciar sesión para comentar.

Más respuestas (4)

Babak
Babak el 14 de Ag. de 2012
A*cos(x)+B/sin(x)=C
multiply both sides by sin(x) to get:
A * sin(x)*cos(x) + B = C * sin(x)
now use the following relations: sin(x) = 2u/(1+u^2) and cos(x)=(1-u^2)/(1+u^2) where u=tan(x/2) to get:
A*(2*u)*(1-u^2)+B(1+u^2)^2=C*(1+u^2)*2u
which is a fourth order equations. I would simplify it and solve it numerically with fsolve:
B*u^4-2*(A+C)*u^3+2*B*u^2+2*(A-C)*u+B=0

Manal Alhammadi
Manal Alhammadi el 31 de En. de 2018
where y=2+3e^(-2t) t=0:0.1:3

Manal Alhammadi
Manal Alhammadi el 31 de En. de 2018
y=2+3e^(-2t)

Cheng Chen
Cheng Chen el 26 de Sept. de 2020

Community Treasure Hunt

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

Start Hunting!

Translated by