Help using fsolve (theta beta mach)

7 次查看(过去 30 天)
Evan Gehret
Evan Gehret 2023-12-14
回答: lazymatlab 2023-12-14
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?

回答(2 个)

Sam Chak
Sam Chak 2023-12-14
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 个评论
Dyuman Joshi
Dyuman Joshi 2023-12-14
Hello @Evan Gehret , if this answer solved your problem, please consider accepting the answer.

请先登录,再进行评论。


lazymatlab
lazymatlab 2023-12-14
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);

类别

Help CenterFile Exchange 中查找有关 Surrogate Optimization 的更多信息

标签

产品


版本

R2023b

Community Treasure Hunt

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

Start Hunting!

Translated by