Tan/ cot angle return

2 Ansichten (letzte 30 Tage)
Patrick Scott
Patrick Scott am 11 Mär. 2021
Beantwortet: Pranav Verma am 15 Mär. 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

Antworten (1)

Pranav Verma
Pranav Verma am 15 Mär. 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

Kategorien

Mehr zu Function Creation finden Sie in Help Center und File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by