Tan/ cot angle return

3 visualizaciones (últimos 30 días)
Patrick Scott
Patrick Scott el 11 de Mzo. de 2021
Respondida: Pranav Verma el 15 de Mzo. de 2021
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

Respuestas (1)

Pranav Verma
Pranav Verma el 15 de Mzo. de 2021
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

Categorías

Más información sobre Function Creation en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by