Tan/ cot angle return

3 次查看(过去 30 天)
Patrick Scott
Patrick Scott 2021-3-11
Is there a way to return both possible angles for the trig equations I used in vpasolve below?
%% Input Inital Conditions and Calculations Problem 2
gamma = 1.4;
M1 = 1.5; %Incoming Mach number
theta0 = 0.001*pi/180; %(inital guess for vpasolve)theta must be greater than zero for oblique shock
syms x
top = (M1^2*(sin(x)^2))-1;
bottom = (M1^2*(gamma + cos(2*x))) + 2;
eq1 = tan(theta0) == 2*cot(x*top/bottom);
beta = vpasolve(eq1,x, theta0); %beta in degrees
beta = double(beta) % Convert beta to a double
betaRad = beta*pi/180; %Beta in radians

回答(1 个)

Pranav Verma
Pranav Verma 2021-3-15
Hi Patrick,
You can find other solutions by specifying the intial guess for other solutions. In your case, you can graph the LHS and RHS your equation,
eq1 = 2*cot(x*top/bottom) == tan(theta0);
to find out the intersecting points and specify the initial guess around those values where the graphs of LHS and RHS intersect each other.
Please refer to the example in the documentation where it is shown for the multiple solutions for the below equation:
% 200 * sin(x) = x^3 - 1
syms x
eqnLeft = 200*sin(x);
eqnRight = x^3 - 1;
fplot([eqnLeft eqnRight])
title([texlabel(eqnLeft) ' = ' texlabel(eqnRight)])
Hope it helps!
Thanks

类别

Help CenterFile Exchange 中查找有关 Gas Dynamics 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by