I have a disgusting equation that needs to be solved for another variable:
tand(theta) = 2*atand(beta)*(M^2*sind(beta)^2-1)/(M^2*(1.4+cosd(2*beta))+2)
I need it to be solved for beta with theta and M known.
How do I use fsolve to solve for that equation?

回答 (2 件)

Star Strider
Star Strider 2022 年 3 月 22 日
編集済み: Star Strider 2022 年 3 月 22 日

1 投票

The fsolve function is a root-finding algorithm, so the search must be for zeros of the function. The function needs to be expressed in that context —
f = @(beta,theta,M) tand(theta) - 2*atand(beta).*(M.^2*sind(beta).^2-1)./(M.^2.*(1.4+cosd(2*beta))+2);
theta = 30;
M = 42;
beta0 = 180*rand; % Can Be Anything
betav = fsolve(@(beta)f(beta,theta,M), beta0)
Equation solved. fsolve completed because the vector of function values is near zero as measured by the value of the function tolerance, and the problem appears regular as measured by the gradient.
betav = 174.7907
NOTE — Since this is a trigonoometric equation, there could be an infinity of solutions, integer multiples of 360°.
.
David Hill
David Hill 2022 年 3 月 22 日

1 投票

syms theta;
beta=35;M=1.3;%example
eqn=tand(theta) == 2*atand(beta)*(M^2*sind(beta)^2-1)/(M^2*(1.4+cosd(2*beta))+2);
vpasolve(eqn)

カテゴリ

ヘルプ センター および File ExchangeProgramming についてさらに検索

質問済み:

2022 年 3 月 22 日

回答済み:

2022 年 3 月 22 日

Community Treasure Hunt

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

Start Hunting!

Translated by