How to solve a transcendental equation?
Show older comments
Hello everyone,
How do I solve the transcendental equation as shown below for 'th'?. All the other variables (z0, tp, v1, y0, x0 and theta01) are known. However the equation is part of a code and the variables (z0, tp, v1, y0, x0 and theta01) are inputs of a function and it will be chosen by the user. So, whenever they input any value for those 6 variables the 'th' must be the output. I've tried to bring only 'th' to one side of the equation but I think is impossible.
Note: I'm new in Matlab. So, please, try to be as clear as possible. Thank you.

Answers (2)
Steven Lord
on 9 May 2017
See the "Root of Function with Extra Parameter" example on the documentation page for the fzero function. Using the terminology from that example, myfun would be a function of th, z0, tp, v1, y0, x0, theta01 that when evaluated would return
(z0 + sqrt(...)) - (v1*th*sin(theta01) + 1/2*g*tp*(tp-2*th))
Then define values for all the variables except th, define fun to be:
fun = @(th) myfun(th, z0, tp, v1, y0, x0, theta01);
and pass fun into fzero.
2 Comments
Andre Almeida
on 10 May 2017
Steven Lord
on 10 May 2017
When I look at the graph of your function using this command:
fplot(fun)
I see that the zero is pretty close to the value of th where the value of fun becomes complex due to the quantity under the square root sign becoming negative. [That's somewhere between 0.686218 and 0.686220.] When I specify an interval that contains the zero instead of just a single point, it works.
th = fzero(fun, [0.69 1])
The upper bound probably doesn't matter too much (as long as it's not extremely large) but the lower bound needs to be between the point where fun turns complex and the zero.
Walter Roberson
on 9 May 2017
syms z0 th tp v1 y0 x0 theta1 g
solve(z0+sqrt((4*th-tp)^2*v1^2-y0^2-(-x0+v1*th*cos(theta1))^2) == v1*th*sin(theta1)+(1/2)*g*tp*(tp-2*th),th)
You have a quadratic, so there will be two solutions. The equation is not transcendental with respect to the variable of interest, th.
2 Comments
Andre Almeida
on 10 May 2017
Torsten
on 10 May 2017
What do you get for x if you use
x=vpa(solve(...))
?
Best wishes
Torsten.
Categories
Find more on Programming in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

