I'm trying to solve for t trigonometric equations in Matlab, as i.e. 7*cos(t) + 5*sin(t) = 0. I would solve it as: sin(t)/cos(t) = -7/5 and I would find it as arctan(-7/5) = -0.9505.

I have tried to do it on matlab using solve function:

syms t
theta = solve(7*cos(t) + 5*sin(t)==0, t);
disp(theta);

But I get -(log(- 12/37 - (35*i)/37)*i)/2 instead of -0.9505. Could someone explain me why I get this answer from solve and how to get -0.9505?

有帮助吗?

解决方案

The expression is the exact result, expressed symbolically (due to the use of syms).

To make Matlab display the result in the format your looking for use double(theta)

which should give you:

double(theta)

ans =

   -0.9505
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top