user1869171
user1869171

Reputation: 51

How can I program MATLAB to calculate the argument of a cubed tangent function?

I need to solve tan^3(w)=tan(s) for w where s= 1.5 radians or 16.845 degrees. I need to write a line of MATLAB code for this operation but do not know an equivalent form of the equation.

Upvotes: 5

Views: 1009

Answers (3)

Milo
Milo

Reputation: 2171

You could also use:

w = atan(tan(1.5)^(1/3))

Upvotes: 0

Jonas
Jonas

Reputation: 74940

To solve the equation without toolboxes, you can use e.g. fzero to find where both sides of the equation are equal.

%# define the function that should be equal to zero
%# i.e. subtract the sides of the equation from one another
fun = @(x)tan(x)^3-tan(1.5)

%# solve the function with initial guess 0
fzero(fun,0)
ans =
    1.1784

Upvotes: 0

Aziz
Aziz

Reputation: 20765

solve('tan(x)^3==tan(1.5)','x')

Answer:

                                      1.1783511187702876557436189917532
- 1.3391755593851438278718094958766 + 0.35610550401885024116569451380696*i
- 1.3391755593851438278718094958766 - 0.35610550401885024116569451380696*i

One real solution, and two complex solutions.

(This was tested in Matlab R2012a)

Upvotes: 2

Related Questions