# Tan/ cot angle return

조회 수: 5(최근 30일)
Patrick Scott 2021년 3월 11일
답변: Pranav Verma 2021년 3월 15일
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

댓글을 달려면 로그인하십시오.

### 답변(1개)

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

댓글을 달려면 로그인하십시오.

### Community Treasure Hunt

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

Start Hunting!