How to properly write a code for this system of nonlinear equations involving hyperbolic and trigonometric functions
조회 수: 3 (최근 30일)
이전 댓글 표시

Hi! So I have the values for T1, T2, what im trying to solve are the values of gamma 1, gamma 2 and alpha0. I was able to write the following code but i believe the outputs are wrong:
T1 = 0.5780;
T2 = 0.1561;
syms y1 y2 alpha0
E1 = -T2/T1 + (y1/y2)*((y1^2+alpha0^2)/(y2^2+alpha0^2))^0.5;
E2 = 2+(2+(alpha0^4/(y2^2*(y2^2+alpha0^2))))*cos(y2)*cosh((y2^2+alpha0^2)^0.5)+((alpha0^2/(y2*(y2^2+alpha0^2)^0.5)))*sin(y2)*sinh((y2^2+alpha0^2)^0.5);
E3 = 2+(2+(alpha0^4/(y1^2*(y1^2+alpha0^2))))*cos(y1)*cosh((y1^2+alpha0^2)^0.5)+((alpha0^2/(y1*(y1^2+alpha0^2)^0.5)))*sin(y1)*sinh((y1^2+alpha0^2)^0.5);
eqs = [E1, E2, E3];
[y1,y2,alpha0] = vpasolve(eqs,[y1,y2,alpha0])
Any help is greatly appreciated. Thank you!
댓글 수: 0
답변 (1개)
Walter Roberson
2021년 10월 1일
You are right, the solutions fail back-substitution
T1 = 0.5780;
T2 = 0.1561;
syms y1 y2 alpha0
E1 = -T2/T1 + (y1/y2)*((y1^2+alpha0^2)/(y2^2+alpha0^2))^0.5;
E2 = 2+(2+(alpha0^4/(y2^2*(y2^2+alpha0^2))))*cos(y2)*cosh((y2^2+alpha0^2)^0.5)+((alpha0^2/(y2*(y2^2+alpha0^2)^0.5)))*sin(y2)*sinh((y2^2+alpha0^2)^0.5);
E3 = 2+(2+(alpha0^4/(y1^2*(y1^2+alpha0^2))))*cos(y1)*cosh((y1^2+alpha0^2)^0.5)+((alpha0^2/(y1*(y1^2+alpha0^2)^0.5)))*sin(y1)*sinh((y1^2+alpha0^2)^0.5);
eqs = [E1, E2, E3];
[y1sol,y2sol,alpha0sol] = vpasolve(eqs,[y1,y2,alpha0])
string(eqs)
simplify(subs(eqs, {y1, y2, alpha0}, {y1sol, y2sol, alpha0sol}))
댓글 수: 7
Alex Sha
2021년 10월 5일
How about the results below:
y1: -1.90447748745904
y2: -4.93345791290994
alpha0: -4.02843940412624
Fevl:
-8.32667268468867E-16
-3.32534000335727E-12
1.13686837721616E-12
참고 항목
카테고리
Help Center 및 File Exchange에서 Equation Solving에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

