Root finder solver for cubic equation
조회 수: 1 (최근 30일)
이전 댓글 표시
I have the following cubic equation in beta, knowing gamma, theta and M1 how can I find the roots of beta using MATLAB?
for example, knowing the following:
M1 = 8:3:20;
gamma = 1.4;
theta = 8;
댓글 수: 3
채택된 답변
Walter Roberson
2021년 3월 8일
syms M1 gamma theta_degrees tanbeta_degrees
eqn = 1 + (gamma - 1)/2 * M1.^2 * tand(theta_degrees).*tanbeta_degrees.^3 + (1-M1.^2).*tanbeta_degrees.^2 + (1+(gamma+1)/2.*M1.^2);
solbeta = solve(eqn, tanbeta_degrees);
beta_degrees = atand(solbeta)
M1_ = 8:3:20;
gamma_ = 1.4;
theta_degrees_ = 8; %in degrees
beta_values = subs(beta_degrees, {M1, gamma, theta_degrees}, {M1_, gamma_, theta_degrees_})
beta_numeric = double(beta_values)
whos beta_numeric
Here, the different columns correspond to the different M1 values, and the different rows correspond to the different roots of the cubic. Results are in degrees.
댓글 수: 0
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Gamma Functions에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!