Clear Filters
Clear Filters

Help using fsolve (theta beta mach)

8 views (last 30 days)
Evan Gehret
Evan Gehret on 14 Dec 2023
Answered: lazymatlab on 14 Dec 2023
I need to solve for theta when M1 and beta are known, I believe this is the formula I need to translate, but I am not too proficient in matlab and unsure how to turn this into code.
How do I use f solve or another formula to solve for theta?

Answers (2)

Sam Chak
Sam Chak on 14 Dec 2023
If you have all the information on the right-hand side of the equation, then I think applying the inverse tangent (also known as arctangent) can give you the solution for θ. Look up atan and atan2.
help atan
ATAN Inverse tangent, result in radians. ATAN(X) is the arctangent of the elements of X. See also ATAN2, TAN, ATAND, ATAN2D. Documentation for atan doc atan Other uses of atan codistributed/atan gpuArray/atan symbolic/atan dlarray/atan sym/atan tabular/atan
help atan2
ATAN2 Four quadrant inverse tangent. ATAN2(Y,X) is the four quadrant arctangent of the elements of X and Y such that -pi <= ATAN2(Y,X) <= pi. X and Y must have compatible sizes. In the simplest cases, they can be the same size or one can be a scalar. Two inputs have compatible sizes if, for every dimension, the dimension sizes of the inputs are either the same or one of them is 1. See also ATAN, ATAN2D. Documentation for atan2 doc atan2 Other uses of atan2 codistributed/atan2 gpuArray/atan2 symbolic/atan2 dlarray/atan2 sym/atan2 tabular/atan2 fixedpoint/atan2
  1 Comment
Dyuman Joshi
Dyuman Joshi on 14 Dec 2023
Hello @Evan Gehret , if this answer solved your problem, please consider accepting the answer.

Sign in to comment.

lazymatlab on 14 Dec 2023
You do not need fsolve. Code below would be enough.
num = M1^2 * (sin(beta))^2 - 1;
den = M1^2 * (gamma + cos(2*beta)) + 2;
theta = atan(2 * cot(beta) * num / den);


Find more on Mathematics 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!