Finding an angle in a trigonometric function using 2 equations
조회 수: 2 (최근 30일)
이전 댓글 표시
Hello everybody,
I am trying to find beta angle in the eqns. below. I tried "vpasolve, linsolve, solve" but none of them seem to work.
syms M gamma
M=7.0;
gamma=1.3;
x=0:(0.01):2;
dy=((2.25+4*x-x.^2).^(-1/2)).*(2-x);
beta = solve(dy==2/cotd(beta)*((M.^2*sin(beta.^2)-1)/(M.^2*(gamma+cos(beta)^2)+2)), beta)
pressureratio= 1+(2*gamma)/(gamma+1)*((M*sind(beta)).^2-1)
I always end up getting a different error message. Is there a way to find beta?
댓글 수: 2
Dyuman Joshi
2024년 3월 23일
You have not provided M and gamma values.
Also, gamma is a inbuilt function in MATLAB. Best to not name variables (or scripts for that matter) using function names. You could use k instead.
"I tried "vpasolve, linsolve, solve" but none of them seem to work."
답변 (1개)
Dyuman Joshi
2024년 3월 23일
As you are solving for beta, you have to define beta as a symbolic variable.
Also, I have reduced the step size in x, as the variation for smaller values of x (and thus dy) is minute.
syms beta
M=7.0;
k=1.3;
x=0:(0.1):2;
dy=((2.25+4*x-x.^2).^(-1/2)).*(2-x);
n = numel(x);
%Pre-allocate output variable
out = zeros(1,n);
%Svoling equations separately
for r = 1:n
eqn = dy(r)==2/cotd(beta)*((M.^2*sin(beta.^2)-1)/(M.^2*(k+cos(beta)^2)+2));
out(r) = vpasolve(eqn, beta);
end
out
pressureratio = 1+(2*k)/(k+1)*((M*sind(out)).^2-1)
댓글 수: 3
참고 항목
카테고리
Help Center 및 File Exchange에서 Particle & Nuclear Physics에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!