Vpa Solve solving for B

조회 수: 2 (최근 30일)
Benneth Perez
Benneth Perez 2021년 10월 24일
편집: Benneth Perez 2021년 10월 25일
Hello,
This is a follow up question to this one. Previous Question
For some reason i was previously getting a different answer using vpasolve and vpa which now works and I get the right answers for solving for the Beta variable. I'm now using the code to solve B for when the values of M1=3 and theta2=15. When i do this i start getting results with imaginary answers.
The correct answer should be something like 32.24 but I'm getting:
beta =
84.4217 + 5.8932e-37i
M1 = 3;
P1 = 1;
theta2 = 15;
thetha3 = 20;
gamma = 1.4;
syms beta
tantheta = tand(theta2);
x = 2*cotd(beta)*((M1^2*((sind(beta))^2)-1));
y = M1^2*(gamma+cosd(2*beta))+2;
eqn = x/y;
result = solve(tantheta == eqn, beta);
beta = vpa(result)+180

채택된 답변

Walter Roberson
Walter Roberson 2021년 10월 24일
M1 = 3;
P1 = 1;
theta2 = 15;
thetha3 = 20;
gamma = 1.4;
syms beta
tantheta = tand(theta2);
x = 2*cotd(beta)*((M1^2*((sind(beta))^2)-1));
y = M1^2*(gamma+cosd(2*beta))+2;
eqn = x/y;
b0 = 1;
result = vpasolve(tantheta == eqn, beta, b0);
beta = vpa(result)+180
beta = 
212.24040018274467042158222540358
  댓글 수: 1
Benneth Perez
Benneth Perez 2021년 10월 25일
편집: Benneth Perez 2021년 10월 25일
Hello,
Thank you for the help the solution which im looking for is the first one, should be 32.26. 212 does look like a solution however is not the smallest solution(first solution).
Do you mind telling me whath B0 =1; is for ?
My guess is that this is a first guess for the solution computation?
Follow up: Wow! actually this works! Exactly what my code needed, all i needed to do was remove the 180 and it gives me the solution im looking for. Adding 180 gives me the 4 solution.
Thank you

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Linear Algebra에 대해 자세히 알아보기

제품


릴리스

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by