Cannot solve x*tan(x/w)=C in matlab, please help

2 views (last 30 days)
The equation is x*tan(x/w)=C and .
w = 1e-6 C = 3.5e3
Here's how I do it:
x0 = pi/4
eq = sprintf('x*tan(x/%g) == %g', w, C);
gamma_pde = fzero(eq4, x0)
Depending on the value of x0, I get different results which are totally wrong, and do not work in the original equation. I know that this equation has infinite number of answers, that's why I'm setting x0, but I dont seem to have any luck solving it with matlab.
I dont know if I can use some other commands like solve, b/c this equation has so many answer.
Thanks for reading.
  1 Comment
Oleg Komarov
Oleg Komarov on 1 Aug 2011
Please format the code properly: http://www.mathworks.com/matlabcentral/answers/7885-tutorial-how-to-format-your-question

Sign in to comment.

Answers (1)

Oleg Komarov
Oleg Komarov on 1 Aug 2011
eq4 = @(x) x*tan(x/w)-C;
Use anonymous functions but be careful with the constants (see paragraph Variables Used in the Expression)

Community Treasure Hunt

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

Start Hunting!